Simple, quick, question.
How can i pass a hash or associative array through my view/javascript to rails controller.
In the contoller i want to use hash object in ActiveRecord’s new method
some thing like this
hash = {}
hash = params[data]
Task.new(hash)
I can pass and read individual fields, but i am looking for a better way.
Thnx.
That should work, actually. Did you try it out?
Here’s a one-liner:
You should be aware that arbitrary values can be passed by the client, creating a potential mass assignment security issue. Make sure to define mass assignable fields with
attr_accessible.