diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-11-29 10:09:42 -0800 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-11-29 10:09:42 -0800 |
commit | 2169603385a447256d713873be6b2fbb6e2591fa (patch) | |
tree | 8a56b9264808c0e7b0cba8fc895e364a75c3bc05 /activerecord/lib/active_record/base.rb | |
parent | d534c8fbe26dbc1101d80ad3af4cf166d0e3cda8 (diff) | |
parent | c347b3c06c2867badce5e22ecfbed3e972960c29 (diff) | |
download | rails-2169603385a447256d713873be6b2fbb6e2591fa.tar.gz rails-2169603385a447256d713873be6b2fbb6e2591fa.tar.bz2 rails-2169603385a447256d713873be6b2fbb6e2591fa.zip |
Merge pull request #3636 from joshsusser/master
association methods are now generated in modules
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3d23565ff9..e1908312b8 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -450,6 +450,20 @@ module ActiveRecord #:nodoc: :having, :create_with, :uniq, :to => :scoped delegate :count, :average, :minimum, :maximum, :sum, :calculate, :to => :scoped + def inherited(child_class) #:nodoc: + # force attribute methods to be higher in inheritance hierarchy than other generated methods + child_class.generated_attribute_methods + child_class.generated_feature_methods + super + end + + def generated_feature_methods + unless const_defined?(:GeneratedFeatureMethods, false) + include const_set(:GeneratedFeatureMethods, Module.new) + end + const_get(:GeneratedFeatureMethods) + end + # Executes a custom SQL query against your database and returns all the results. The results will # be returned as an array with columns requested encapsulated as attributes of the model you call # this method from. If you call <tt>Product.find_by_sql</tt> then the results will be returned in |