You can also try using <%= hidden_field_tag 'checks[name]', @c.name %> <%= hidden_field_tag 'checks[number]', @c.number %>
So you don't have to parse it in the create action. On Tue, Feb 8, 2011 at 6:51 PM, Srikanth Jeeva <[email protected]> wrote: > > What you can consider doing is attaching the Check object's id into the > > hidden_field, and then pass the id into your create method. > > Actually there was no id for that object. > > I did like this. converted to json and parsed it. > > def new > @c = Check.new > @c.name = "Srikanth" > @c.number = 1234 > @a = @c.to_json > end > > And in View: > <%= hidden_field_tag "checks", @a %> > > def create > p = JSON.parse(params[:checks]) > puts p.inspect > end > > got p as, > {"check"=>{"name"=>"Srikanth", "number"=>1234}} > > Thanks all for reply. > > -- > 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 [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. > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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 [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.

