I have a simple database: a list of manufacturers (parent) and the parts (child) for the manufacturer.>From scaffold, I have a ?show? view listing manufacturers. I modifiedthis view to list the parts for the manufacturer. I also have a link to create a new part. This causes the controller to display a new view to create a new part for the manufacturer. So creating the part is AOK, I can even assign the manufacturer?s key to the part (by passing the manufacturer ID though the session), however, I want to return back to the manufacturer ?show? view. I keep on getting the error: "Couldn''t find Manufacturer without an ID" Basically the manufacturer ?show? screen cannot find an ID to display. I have tried: - passing the manufacturer ID through the session - setting a class level variable (if there is such a thing) Any ideas? thanks Don -- Posted via http://www.ruby-forum.com/.
why can''t you simply pass it as parameter when redirecting to "show" view? don cameron wrote:> Basically the manufacturer ?show? screen cannot find an ID to display. > > I have tried: > > - passing the manufacturer ID through the session > - setting a class level variable (if there is such a thing) > > > > Any ideas? > > thanks > Don-- Posted via http://www.ruby-forum.com/.
> So creating the part is AOK, I can even assign the manufacturer?s key > to the part (by passing the manufacturer ID though the session), > however, I want to return back to the manufacturer ?show? view. I keep > on getting the error: > > > "Couldn''t find Manufacturer without an ID"The link back to the manfacturer show view needs to include the id ie manufacture/show/id # manufacture/show/1 use the link helper to write the manufacturer id in the session into the link not sure of the exact syntax but something akin to: <%= link_to ''Show'', :action => ''show'', :id => @session.manufacturer_id %> _tony -- Posted via http://www.ruby-forum.com/.