aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 60bd38e74c..f6954813a4 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2528,6 +2528,13 @@ module ActiveRecord #:nodoc:
(id = self.id) ? id.to_s : nil # Be sure to stringify the id for routes
end
+ # Returns the ActiveRecord object when asked for its
+ # ActiveModel-compliant representation, because ActiveRecord is
+ # ActiveModel-compliant.
+ def to_model
+ self
+ end
+
# Returns a cache key that can be used to identify this record.
#
# ==== Examples