There’s a number of calls in the Rails source to convert_to_model,
which takes an activerecord object instance:
convert_to_model(object)
Here’s the thing. All convert_to_model does is calls to_model, which
returns self (the ActiveModel instance).
Am I missing something here? Why call a method that returns the same
thing?
@user
=> #<User id: 3, name: “dscdsf”, email: “[email protected]”,
encrypted_password: “”, phone: “9544443456”, address: “fvfdvf”,
reset_password_token: nil, reset_password_sent_at: nil,
remember_created_at: nil, sign_in_count: 1, current_sign_in_at:
“2011-09-27 17:01:45”, last_sign_in_at: “2011-09-27 17:01:45”,
current_sign_in_ip: “127.0.0.1”, last_sign_in_ip: “127.0.0.1”,
created_at: “2011-09-12 16:55:30”, updated_at: “2011-09-27 17:01:45”,
account_id: 1, role_id: 1, authentication_token: nil>
@user.to_model
=> #<User id: 3, name: “dscdsf”, email: “[email protected]”,
encrypted_password: “”, phone: “9544443456”, address: “fvfdvf”,
reset_password_token: nil, reset_password_sent_at: nil,
remember_created_at: nil, sign_in_count: 1, current_sign_in_at:
“2011-09-27 17:01:45”, last_sign_in_at: “2011-09-27 17:01:45”,
current_sign_in_ip: “127.0.0.1”, last_sign_in_ip: “127.0.0.1”,
created_at: “2011-09-12 16:55:30”, updated_at: “2011-09-27 17:01:45”,
account_id: 1, role_id: 1, authentication_token: nil>
it returns the same exact thing…