Can't mass-assign protected attributes: created_at(2i), created_at(3i), created_at(1i), created_at(4i), created_at(5i)
我的代碼如下:::加載ActiveModel :: MassAssignmentSecurity中的錯誤SubjectsController#創建
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')
是什麼問題?
我有需要更新到Rails 3.2的遺留應用程序白名單屬性設置爲false,但我仍然收到這個錯誤 – bbozo