Can't mass-assign protected attributes: created_at(2i), created_at(3i), created_at(1i), created_at(4i), created_at(5i)
我的代码如下:
def new
@subject = Subject.new(:name => 'default')
@subject_count = Subject.count + 1
end
def create
# Instantiate a new object using form parameters
@subject = Subject.new(params[:subject])
# Save the object
if @subject.save
# If save succeeds, redirect to the list action
flash[:notice] = "Subject created."
redirect_to(:action => 'list')
else
# If save fails, redisplay the form so user can fix problems
@subject_count = Subject.count + 1
render('new')
问题是什么?