Hi, I have a form that I need to add default data when is passed into
the DB…
for example I have a create post, were the user can add tittle, text
etc…
but I need to add who created so is on record etc
I will like to know how will I do this from the model, since I think
that is the right place to do this…
on php I will just add hiden fields to the form and pass the variables
but there should be a nice way in rails…
thanks
On Tue, Aug 5, 2008 at 12:30 AM, rek2 [email protected] wrote:
Hi, I have a form that I need to add default data when is passed into
the DB…
for example I have a create post, were the user can add tittle, text etc…
but I need to add who created so is on record etc
I will like to know how will I do this from the model, since I think
that is the right place to do this…
on php I will just add hiden fields to the form and pass the variables
but there should be a nice way in rails…
Post.create( params[:post].merge( :user_id => session[:user_id] ) )
–
Greg D.
http://destiney.com/