2009/7/1 khagimoto <[email protected]>: > > Hello, > > I'm trying to check some value in the controller so that I can change > the behavior accordingly. I have a form set up such that when > submitted, the params looks like this: > > { > "transport"=>{ > "from_location"=>"Portland", > > "transports_transits_attributes"=>{"1246482280809"=>{"city"=>"Osaka", > "country"=>"2"}, > "0"=>{"city"=>"Seattle", > "country"=>"1"}}, > > "to_location"=>"Tokyo", > "departure_date"=>"01-Jul-2009", > "arrival_date"=>"02-Jul-2009"} > } > > My question is in regards to the nested table "transports_transits" > that you see in the middle with two records. How would I access the > specific values in the nested table? I know I can populate the model > by @transport = Transport.new(params[:transport]), but what if I want > to access one of the values in "transports_transits" table, say, to > get value "Osaka"? >
If I understand the question correctly you eant something like params[:transports_transits_attributes][:1246482280809][:city] I think. Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

