Ruby on Rails Wednesday, June 3, 2015

Member of a FaceBook group helped me figure it out by adding a little
extra logic in the controller save.

if @campaign.save

zip = Uploadzip.find(params[:uploadzip_id])
zip.campaign = @campaign
zip.save

flash[:success] = "Campaign Successfully Launched!"
redirect_to @campaign
else
flash[:error] = "There was a problem launching your Campaign."
redirect_to new_campaign_path
end

This was met with changing the select_tag's name to..

<%= select_tag :uploadzip_id,
options_from_collection_for_select(
Uploadzip.all, :id, :file_name
), { include_blank: "Include a Zip File" } %>

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cecaf08a255ad56d6ecb7bb709939b60%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment