I have a RESTful implementation. The index view shows a table with two columns: 1) Site_id and 2) URL to create a New Review for the corresponding site_id. Each row of the table is rendered using a partial. If the URL is clicked, a form is presented by the "new" method to create a new review for a site. Right now I only know to generate each URL with new_review_path, which creates the same URL for all rows, leading to a black form to create a new review. I want this form to be prefilled with the value of the corresponding site_id in the site_id column. That means somehow each URL to create a new review has to be different from one another. How can I do this? Thanks Vincent -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
sorry, I meant right now I only know to generate each URL with new_review_path, which creates the same URL for all rows, leading to a blank form to create a new review. I would like each form to be prefilled with the corresponding site_id. thanks. On Dec 31, 12:48 am, Vincent P <ease...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a RESTful implementation. The index view shows a table with > two columns: 1) Site_id and 2) URL to create a New Review for the > corresponding site_id. Each row of the table is rendered using a > partial. > > If the URL is clicked, a form is presented by the "new" method to > create a new review for a site. Right now I only know to generate > each URL with new_review_path, which creates the same URL for all > rows, leading to a black form to create a new review. > > I want this form to be prefilled with the value of the corresponding > site_id in the site_id column. That means somehow each URL to create > a new review has to be different from one another. How can I do this? > > Thanks > > Vincent-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Learn by Doing wrote:> I have a RESTful implementation. The index view shows a table with > two columns: 1) Site_id and 2) URL to create a New Review for the > corresponding site_id. Each row of the table is rendered using a > partial. > > If the URL is clicked, a form is presented by the "new" method to > create a new review for a site. Right now I only know to generate > each URL with new_review_path, which creates the same URL for all > rows, leading to a black form to create a new review. > > I want this form to be prefilled with the value of the corresponding > site_id in the site_id column. That means somehow each URL to create > a new review has to be different from one another. How can I do this?Read up on nested resources. That''s how I would most likely implement something like what you describe. http://guides.rubyonrails.org/routing.html#nested-routes -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Robert. Unfortunately, I already implemented the site model not using REST and the review model as REST but standing alone not belonging to another REST model. Is there any other way around this? Thanks. -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Robert Walker Sent: Thursday, December 31, 2009 9:33 AM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] Re: RESTful new method Learn by Doing wrote:> I have a RESTful implementation. The index view shows a table with > two columns: 1) Site_id and 2) URL to create a New Review for the > corresponding site_id. Each row of the table is rendered using a > partial. > > If the URL is clicked, a form is presented by the "new" method to > create a new review for a site. Right now I only know to generate > each URL with new_review_path, which creates the same URL for all > rows, leading to a black form to create a new review. > > I want this form to be prefilled with the value of the corresponding > site_id in the site_id column. That means somehow each URL to create > a new review has to be different from one another. How can I do this?Read up on nested resources. That''s how I would most likely implement something like what you describe. http://guides.rubyonrails.org/routing.html#nested-routes -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I finally figured out that I need to pass these things through params. Thanks. On Dec 31 2009, 11:48 am, "Easebus" <ease...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Robert. Unfortunately, I already implemented the site model not > using REST and the review model as REST but standing alone not belonging to > another REST model. Is there any other way around this? Thanks. > > -----Original Message----- > From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Robert Walker > Sent: Thursday, December 31, 2009 9:33 AM > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Subject: [Rails] Re: RESTful new method > > Learn by Doing wrote: > > I have a RESTful implementation. The index view shows a table with > > two columns: 1) Site_id and 2) URL to create a New Review for the > > corresponding site_id. Each row of the table is rendered using a > > partial. > > > If the URL is clicked, a form is presented by the "new" method to > > create a new review for a site. Right now I only know to generate > > each URL with new_review_path, which creates the same URL for all > > rows, leading to a black form to create a new review. > > > I want this form to be prefilled with the value of the corresponding > > site_id in the site_id column. That means somehow each URL to create > > a new review has to be different from one another. How can I do this? > > Read up on nested resources. That''s how I would most likely implement > something like what you describe. > > http://guides.rubyonrails.org/routing.html#nested-routes > -- > Posted viahttp://www.ruby-forum.com/. > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.