ActiveModel::MassAssignmentSecurity::Error in Devise::RegistrationsController#create #1866

Closed
mzaragoza opened this Issue May 21, 2012 · 1 comment

Comments

Projects
None yet
2 participants

i am trying to update Divice so my Usermodel has a firstname, lastname, and not just a email and password

so i created a migration

db/migrate/20120521142938_add_username_fistname_lastname_to_users.rb

class AddFistnameLastnameToUsers < ActiveRecord::Migration
def change
add_column :users, :fistname, :string
add_column :users, :lastname, :string
end
end

i also did

rails generate devise:install

To be able to modify the views

This is the new account view
app/views/devise/registrations/new.html.erb

Sign up

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>

<%= f.label :email %>
<%= f.email_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %>
<%= f.label :fistname %>
<%= f.text_field :fistname %>
<%= f.label :lastname %>
<%= f.text_field :lastname %>
<%= f.submit "Sign up" %>
<% end %>

<%= render :partial => "devise/shared/links" %>

my Error
When i submit this form i get a error that reads

ActiveModel::MassAssignmentSecurity::Error in Devise::RegistrationsController#create

Can't mass-assign protected attributes: fistname, lastname

Rails.root: /Users/moiseszaragoza/Sites/test_divice
Application Trace | Framework Trace | Full Trace

Request

Parameters:

{"utf8"=>"✓",
"authenticity_token"=>"n2Ee9vXZWFa895MSVzBblkPjcbkCX4A4yvs/EV2qxwI=",
"user"=>{"email"=>"mZaragoza@circletechfl.com",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]",
"fistname"=>"Moises",
"lastname"=>"Zaragoza"},
"commit"=>"Sign up"}

Show session dump

Show env dump
Response

Headers:

None

Owner

josevalim commented May 21, 2012

Please use the mailing list for questions.

josevalim closed this May 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment