Hi
I have a quick creation form (in a form) : the displayed fields
correspond only to some of the attributes of the corresponding model.
In my controller , create action :
esaily, i would like to use the :
@user = User.new(params[:user])
if @user.save
#success
else
#failure
end
But i would like to know if the generated SQL statement for creation
will include all the columns of the mapped table by my model (i think
yes…)
Is there a tip to only save fields that are not empty for example or
better, only certain named fields:
The table has many columns : col1, col2, col3, col4, …, colN
I’d like to have an INSERT statement like this one :
INSERT INTO Users(col1, col2, col3, col4) VALUES (‘a’, ‘b’, ‘c’, ‘d’)
– Others columns : col5…colN are not concerned by this INSERT
Thanks
Laurent