Hallo, when I''m updating data the form, in development.log I get following: Parameters: {"utf8"=>"✓", "authenticity_token"=>"CoswtfwZJa2cUlwama/RcsWdxQWbUmRRzv6JbkfSUfw=", "tbl_test"=>{"title"=>"Miller", "ref_recclass_id"=>"1", "ref_reckat_id"=>"6", "ref_reckind_id"=>""}, "commit"=>"Save", "id"=>"1"} In the controller (update action), when I try to retrieve data from the post request, I only can retrieve the value of the id with @test params[:id]), but not for example the value of ref_reckind_id with @test = :ref_reckind_id. Do somone have any suggestion how to retrieve the values of the other attributes? Thanks ahead!! Regs Herman -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 28 February 2012 15:17, Herman Müller <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hallo, > > when I''m updating data the form, in development.log I get following: > > Parameters: {"utf8"=>"✓", > "authenticity_token"=>"CoswtfwZJa2cUlwama/RcsWdxQWbUmRRzv6JbkfSUfw=", > "tbl_test"=>{"title"=>"Miller", "ref_recclass_id"=>"1", > "ref_reckat_id"=>"6", "ref_reckind_id"=>""}, "commit"=>"Save", > "id"=>"1"} > > In the controller (update action), when I try to retrieve data from the > post request, I only can retrieve the value of the id with @test > params[:id]), but not for example the value of ref_reckind_id with @test > = :ref_reckind_id.Since ref_reckind_id is nested inside tbl_test you will have to use something like params[:tbl_test][:ref_recking_id] Colin> > Do somone have any suggestion how to retrieve the values of the other > attributes? > > Thanks ahead!! > > Regs > > Herman > > -- > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- gplus.to/clanlaw -- 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.
On Tue, Feb 28, 2012 at 4:17 PM, Herman Müller <lists@ruby-forum.com>wrote:> Hallo, > > when I''m updating data the form, in development.log I get following: > > Parameters: {"utf8"=>"✓", > "authenticity_token"=>"CoswtfwZJa2cUlwama/RcsWdxQWbUmRRzv6JbkfSUfw=", > "tbl_test"=>{"title"=>"Miller", "ref_recclass_id"=>"1", > "ref_reckat_id"=>"6", "ref_reckind_id"=>""}, "commit"=>"Save", > "id"=>"1"} > > In the controller (update action), when I try to retrieve data from the > post request, I only can retrieve the value of the id with @test > params[:id]), but not for example the value of ref_reckind_id with @test > = :ref_reckind_id. > > Do somone have any suggestion how to retrieve the values of the other > attributes? >The :ref_reckind_id key is inside a hash that is itself inside the params hash. Try this: params[:tbl_test][:ref_reckat_id]. But typically, you will not use this formulation directly, rather code like: tbl_test = TblTest.find(params[:id]) if tbl_test.update_attributes(params[:tbl_test]) # here the "internal" hash is supplied to update_attributes) # success else # handle failure end HTH, Peter -- 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.
Found the solution by myself: @test = [:tbl_test][:ref_recclass_id] then @test = 6 -- 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.
Thank you Peter, I didn''t refreshed my browser since I posted my question. So I found your solution after i found it by myself. I think, if I refreshed it earlier, I have saved two hours work. Regs Herman -- 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.
On Tue, Feb 28, 2012 at 6:28 PM, Herman Müller <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Thank you Peter, >and Colin ...> I didn''t refreshed my browser since I posted my question. > > So I found your solution after i found it by myself. > > I think, if I refreshed it earlier, I have saved two hours work. >... but you learned a lot more by searching it yourself :-) Peter -- 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.