Why "login: nil"

51 views Asked by At

cart.rb

class Cart < ActiveRecord::Base

  belongs_to :user

end

user.rb

class User < ActiveRecord::Base

  attr_accessor :login

  has_one :cart

end

when I create a user in rails console, message:

E:\work\my_store>rails c
DL is deprecated, please use Fiddle
Loading development environment (Rails 4.1.8)
irb(main):001:0> user1 = User.new(login: "user1")
=> #<User id: nil, login: nil, created_at: nil, updated_at: nil>
irb(main):002:0>

Why not login assigned value " login: "user1" " ? Help me to solve this

0

There are 0 answers