Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1899

attr_accessible not stopping Mass Assignment in Rails 3.2.3

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.8
    • Affects Version/s: None
    • Component/s: None

      Maybe it's just me but I've been trying to set attr_accessible in my model to stop mass assignment on crypted_password, and salt and it is not stopping mass assignment. Can anyone else confirm this? I'm on Rails 3.2.3 with ruby 1.9.3p125.

      class User
        include Mongoid::Document
        field :email, :type => String
        field :crypted_password, :type => String
        field :salt, :type => String
        field :first_name, :type => String
        field :last_name, :type => String
      
        authenticates_with_sorcery!
        attr_accessible :email, :password, :password_confirmation, :first_name, :last_name
      
        validates_length_of :password, :minimum => 5, :message => "password must be at least 5 characters long", :if => :password
        validates_confirmation_of :password, :message => "should match confirmation", :if => :password
        validates_presence_of :password, :on => :create
        validates_presence_of :email
        validates_uniqueness_of :email
      end
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            nickpoorman nickpoorman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: