Thursday, April 18, 2013

[Rails] Pass variable to action

Hi,

Still learning rails and have a basic question. Can I pass any variable
thru the params hash to an action?

eg "in_progress"

View:
<%= f.submit "Add image/video", :in_progress=> "true" %>

Controller:
def update
@question = Question.find(params[:id])

if params[:in_progress] == "true"
@question.attributes = params[:question]
if @question.save(:validate => false)
redirect_to gallery_path(session[:minisection_id]), id:
"image_gallery"
end
else....

Im trying to set flag to bypass validation and redirect in update
action.

Thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate