class StudentsController < ApplicationController
def new
@student = Student.new
end
def create
@student = Student.new(params[:student])
if @student.save
redirect_to new_student_path
end
end
end
Since Rails 4, you couldn’t just forward a complete params hash to your model. You could but you have to deactivate Strong Parameters before. Anyways, I highly recommend you to follow this practices since your approach opens a really big vulnerability.
For example:
You have an attribute “role” in your model. The user just have to add the attribute “role” to the parameters and is able to modify this protected attribute.