Answer the question
In order to leave comments, you need to log in
How to fix ActiveRecord::DangerousAttributeError?
Hello!
When submitting the form, this error pops up:
Here is student_controller.rb:
class StudentController < ApplicationController
def index
end
def registration
# @student = Student.new
end
def create
@student = Student.new(student_params)
end
private def student_params
params.require(:student).permit(:first_name)
end
end
Answer the question
In order to leave comments, you need to log in
api.rubyonrails.org/classes/ActiveRecord/Dangerous...
Apparently first_name is reserved in ActiveRecord, try renaming it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question