Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment