Created
April 20, 2016 23:22
-
-
Save regularlady/ba3eb3244e55ac55cb8a86da85b8b142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@sponsored_post = SponsoredPost.new | |
@sponsored_post.title = params[:sponsored_post][:title] | |
@sponsored_post.body = params[:sponsored_post][:body] | |
@sponsored_post.price = params[:sponsored_post][:price] | |
topic = Topic.find(params[:topic_id]) | |
@sponsored_post.topic = topic | |
if @sponsored_post.save | |
flash[:notice] = "Sponsored post was saved." | |
redirect_to [topic, @sponsored_post] | |
else | |
flash[:error] = "There was an error saving the sponsored post. Please try again." | |
render :new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment