I wonder, is there an easier way to do the following
#controller's action
@my_model = MyModel.create field1: params[:field1],
field2: params[:field2],
field3: params[:field3],
field4: params[:field4]
# and so on.....
I would use
@my_model = MyModel.create params
but would it work since params always contains other keys added by Rails?
P.S. The same question for updating a model (would this work properly?)
MyModel.update_attributes params
params[:my_model]or whatever it's sending. If you can't, that means that you're not using the Rails form/form fields, or aren't naming them properly. Either that, or you should use a form model containing only the fields you need.