Topic: 7.25 mass assing admin
I am using a newer version of rails and ran into mass assign attributes problem. I've solved this in the controller as follows:
admin = params[:user].delete(:admin)
@user = User.new(params[:user])
if @user.save && @user.update_attribute("admin", admin == "1")
redirect_to admin_users_path, notice: "User has been created."
flash[:alert] = "User has not been created."
render action: "new"
All my tests pass now, but (as a newbe) I am still a bit insecure about it. Can anyone tell me if this solution works, or did I miss something.