> 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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to