我在Rails3应用程序中使用了设计。我面临的问题是保存后电子邮件字段将作为空白字符串返回。
resource.save
Rails.logger.info p resource
这会让我回头
#<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>
但是当我查询控制台时,它给了我正确的答案。
#<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>
为什么会这样?我在这里做错了吗?