I am using devise in my Rails3 application.The problem I am facing is the email field is being returned as a blank string after save.
resource.save
Rails.logger.info p resource
This returns me
#<User id: 1850, email: "", encrypted_password: "$2a$10$EZnvzTKpgYyN2K8I20vXBuk6OZ.XQ6gfOCbOUyfkDKx/...", 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, confirmation_token: "6e6c41315002a24cf63e4512ab94f693ef9d419218e1cbb9a2d...", confirmed_at: nil, confirmation_sent_at: "2015-07-02 04:49:23", unconfirmed_email: "anildiasdavis@gmail.com", company_code: "WNZQIFHN", partner_id: nil, partner_type: nil, super_admin_id: nil, super_admin_type: nil, device_token: nil, is_active: nil, is_disabled: false, total_session_time: "0:0:0", status: "pending", created_at: "2015-07-02 04:49:20", updated_at: "2015-07-02 04:49:20", doctor_id: nil, last_notified_offer_id: nil, is_deleted: false, remove_reason: nil, active_at: nil, deactivated_at: nil, was_disabled: false, is_first_menu_selection: true, is_default_filter: true>
But when I query the console it gives me the correct response.
#<User id: 1850, email: "anildiasdavis@gmail.com", encrypted_password: "$2a$10$EZnvzTKpgYyN2K8I20vXBuk6OZ.XQ6gfOCbOUyfkDKx/...", 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, confirmation_token: "6e6c41315002a24cf63e4512ab94f693ef9d419218e1cbb9a2d...", confirmed_at: nil, confirmation_sent_at: "2015-07-02 04:49:23", unconfirmed_email: "anildiasdavis@gmail.com", company_code: "WNZQIFHN", partner_id: nil, partner_type: nil, super_admin_id: nil, super_admin_type: nil, device_token: nil, is_active: nil, is_disabled: false, total_session_time: "0:0:0", status: "pending", created_at: "2015-07-02 04:49:20", updated_at: "2015-07-02 04:49:20", doctor_id: nil, last_notified_offer_id: nil, is_deleted: false, remove_reason: nil, active_at: nil, deactivated_at: nil, was_disabled: false, is_first_menu_selection: true, is_default_filter: true>
Why does this happen?Am I doing anything wrong here?
Aucun commentaire:
Enregistrer un commentaire