How can you pass an object from the form_for helper to a method?
Posted
by Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2010-05-20T04:10:25Z
Indexed on
2010/05/20
4:20 UTC
Read the original article
Hit count: 159
ruby-on-rails
So let's say I have a form which is being sent somewhere strange (and by strange we mean, NOT the default route:
<% form_for @form_object, :url => {:controller => 'application',
:action => 'form_action_thing'} do |f| %>
<%= f.text_field :email %>
<%= submit_tag 'Login' %>
<% end %>
Now let's say that we have the method that accepts it.
def form_action_thing
User.find(????? :email ?????)
end
My questions are thus:
- How does can I make the object
@form_object
available to the receiving method (in this case,form_action_tag
)?- I've tried
params[:form_object]
, and I've scoured this site and the API, which I have to post below because SO doesn't believe I'm not a spammer (I'm a new member), as well as Googled as many permutations of this idea as I could think of. Nothing. Sorry if I missed something, i'm really trying.
- I've tried
- How do I address the object, once I've made it accessible to the method? Not
params[:form_object]
, I'm guessing.
© Stack Overflow or respective owner