title: WARNING: Can't mass-assign protected attributes for User: login
body: <p><strong>I created two models user.rb and cart.rb</strong></p>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
    attr_accessor :login
  
    has_one :cart
  
  end
  </code></pre>
  
  <p><strong>cart.rb</strong></p>
  
  <pre><code>class Cart &lt; ActiveRecord::Base
  
    belongs_to :user
  
  end
  </code></pre>
  
  <p><strong>when I create a user in rails console, message appears : WARNING: Can't mass-assign protected attributes for User: login</strong></p>
  
  <pre><code>E:\work\my_store&gt;rails c
  DL is deprecated, please use Fiddle
  Loading development environment (Rails 4.1.8)
  irb(main):001:0&gt; user1 = User.new(login: "user1")
  WARNING: Can't mass-assign protected attributes for User: login
  
  =&gt; #&lt;User id: nil, login: nil, created_at: nil, updated_at: nil&gt;
  irb(main):002:0&gt;
  </code></pre>
  
  <p><strong>help me to solve this</strong></p>