aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-08-10 17:42:48 +0100
committerJon Leighton <j@jonathanleighton.com>2012-08-10 23:28:08 +0100
commit6e57d5c5840716b63851f02a6a806ba968065bca (patch)
tree241f62b761113c87ea03f81fa33373e8f5c74ac3 /activerecord/test/models
parent5b3bb61f3fb82c7300d4dac374fe7aeafff6bda0 (diff)
downloadrails-6e57d5c5840716b63851f02a6a806ba968065bca.tar.gz
rails-6e57d5c5840716b63851f02a6a806ba968065bca.tar.bz2
rails-6e57d5c5840716b63851f02a6a806ba968065bca.zip
Use method compilation for association methods
Method compilation provides better performance and I think the code comes out cleaner as well. A knock on effect is that methods that get redefined produce warnings. I think this is a good thing. I had to deal with a bunch of warnings coming from our tests, though.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/author.rb2
-rw-r--r--activerecord/test/models/member.rb5
2 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index 3157d8fe7f..77f4a2ec87 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -93,8 +93,8 @@ class Author < ActiveRecord::Base
has_many :author_favorites
has_many :favorite_authors, -> { order('name') }, :through => :author_favorites
- has_many :tagging, :through => :posts
has_many :taggings, :through => :posts
+ has_many :taggings_2, :through => :posts, :source => :tagging
has_many :tags, :through => :posts
has_many :post_categories, :through => :posts, :source => :categories
has_many :tagging_tags, :through => :taggings, :source => :tag
diff --git a/activerecord/test/models/member.rb b/activerecord/test/models/member.rb
index 359b29fac3..1134b09d8b 100644
--- a/activerecord/test/models/member.rb
+++ b/activerecord/test/models/member.rb
@@ -24,11 +24,10 @@ class Member < ActiveRecord::Base
has_one :club_category, :through => :club, :source => :category
- has_many :current_memberships
- has_one :club_through_many, :through => :current_memberships, :source => :club
-
has_many :current_memberships, -> { where :favourite => true }
has_many :clubs, :through => :current_memberships
+
+ has_one :club_through_many, :through => :current_memberships, :source => :club
end
class SelfMember < ActiveRecord::Base