Group: http://groups.google.com/group/asheville-rb/topics
- setting foreign key relation... [2 Updates]
Mark Locklear <marklo...@gmail.com> Nov 26 04:39PM -0500
Hey guys, I have a parameter that I am setting with a 'link_to' in the view
that looks like this...
<%= link_to 'Register', new_registration_path({:article_id => @article})
%>
...and this correctly takes me to...
http://localhost:3000/registrations/new?article_id=1
Now my question is how do I get this into my parameters when I submit this
page?
In my registrations controller I can do...
def new
@registration = Registration.new
@article = Article.find params[:article_id]
...
end
...and if inspect @article it is correct...
Now I'm just now sure how to get that :article_id parameter over to the
create action.
--
J. Mark Locklear
-Philippians 4:13 gives you the muscle, but YOU have to flex it!
"One machine can do the work of fifty ordinary persons. No machine can do
the work of one extraordinary individual."
-- Elbert HubbardChris Sessions <cses...@gmail.com> Nov 26 06:08PM -0500
Hey Mark,
Your new action would populate an article_id hidden field tag if you include one in your form, and that would be submitted with the rest of the registration form.
You might alternately look at keeping the article_id behind the scenes as a session variable if there's any liability to passing it out in the open.
Hope that helps.
- Chris
You received this message because you are subscribed to the Google Group asheville-rb.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.
--
You received this message because you are subscribed to the Google Groups "Asheville Ruby Users Group" group.
To post to this group, send email to ashevi...@googlegroups.com.
To unsubscribe from this group, send email to asheville-rb...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/asheville-rb?hl=en.