From 6e57d5c5840716b63851f02a6a806ba968065bca Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 10 Aug 2012 17:42:48 +0100 Subject: 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. --- activerecord/test/models/author.rb | 2 +- activerecord/test/models/member.rb | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'activerecord/test/models') 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 -- cgit v1.2.3