Hi there,
I just added two new attributes, created (datetime) and user_id in a db
entity called documents. Those two new attributes are not being saved to
the
db by the activerecord model ‘document’, they remain null after @
document.save. I tried restarting the server, but the problem remains
the
same
Model :
class Document < ActiveRecord::Base
has_many :tag_actions
has_one :user
end
Controller create method
def create
@document = Document.new
@document.title = params[:document][‘title’]
@document.body = params[:document][‘body’]
@document.created = DateTime.now.strftime(“Y-%m-%d %H:%M:%S”)
@document.user = User.find(session[:user_id])
if @document.save
flash[:notice] = ‘Document was successfully created.’
else
flash[:notice] = ‘Could not create document.’
end
redirect_to :action => ‘list’
end