diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-07-20 00:27:04 +0900 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-07-20 00:27:04 +0900 |
commit | 5ffaaa71d149c9807260c950c9a61d01fe734827 (patch) | |
tree | b014dcbe7cc8efabebca38e9e75648905e85017e /activerecord/lib | |
parent | 45d41d8012c605f21de51e7018fa31e1d07776eb (diff) | |
download | rails-5ffaaa71d149c9807260c950c9a61d01fe734827.tar.gz rails-5ffaaa71d149c9807260c950c9a61d01fe734827.tar.bz2 rails-5ffaaa71d149c9807260c950c9a61d01fe734827.zip |
Define ActiveModel API Compliance
- Define to_model on AR
- Define to_model on ActiveModel::APICompliant
- Update test fixtures to be API Compliant
- Start using to_model in AP
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index deab56e219..f32857afa3 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2511,6 +2511,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 |