I am using devise on my rails 4 project, I have 3 custom fields in my User model,
- company_name
- phone_number
- name
When I create a new User at rails console with the following code
u = User.new(email:'example@example.com', company_name: "xxxxxx", phone_number: "12345678", name: "Test Name", password: 'asdfadsf')
Then print out this instance, it shows correctly
#<User id: nil, email: "example@example.com", encrypted_password: "$2a$10$xf9N0xw9zrGBDngD48IdRO9AEUkAJH1/XjOy0dFZTd0L...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: nil, updated_at: nil, organization_id: nil, username: nil, admin: nil, profile_img: nil, tagline: nil, name: "Test Name", status: 1, country_code: nil, phone_number: "12345678", company_name: "xxxxxx">
Then I access devise built in fields, it show the value correctly
u.email => "example@example.com"
but when I try to access the custom field, like company_name, it shows nil instead
u.company_name => nil
Anyone has a clue on this?