Reputation: 91
1 error(s) on assignment of multiparameter attributes error on assignment [2014, 8, 9] to dob (wrong number of arguments (3 for 0..1))
controller code:
def student_params
params.require(:student).permit(:name, :age, :gender, :dob, :email)
end
def create
@student = Student.new(student_params)
respond_to do |format|
if @student.save
format.html { redirect_to @student, notice: 'Student was successfully created.' }
format.json { render :show, status: :created, location: @student }
else
format.html { render :new }
format.json { render json: @student.errors, status: :unprocessable_entity }
end
end
end
view code:
<%= f.label :dob %>
<%= f.date_select :dob %>
Upvotes: 0
Views: 131
Reputation: 6834
The error message is saying that the date_select
is trying to assign three values (year, month, and day) to dob
but it doesn't know how to handle it.
It sounds like you may have created your dob
column as a string
instead of a date
. Can you check your migration to see how dob
was defined?
Upvotes: 1