diff options
author | Szymon Nowak <szimek@gmail.com> | 2009-07-15 22:22:25 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-07-15 18:13:32 -0700 |
commit | 1c11437a32a973fa9b521c32caa7256f9772acd7 (patch) | |
tree | e2a38c67d3ab84c5abdb80756ed69befa36ff574 /activerecord/test/models/reply.rb | |
parent | 0920e69244026ec83471bb4571e56300045307d3 (diff) | |
download | rails-1c11437a32a973fa9b521c32caa7256f9772acd7.tar.gz rails-1c11437a32a973fa9b521c32caa7256f9772acd7.tar.bz2 rails-1c11437a32a973fa9b521c32caa7256f9772acd7.zip |
Add primary_key option to belongs_to association
[#765 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/models/reply.rb')
-rw-r--r-- | activerecord/test/models/reply.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb index 616c07687c..f5906dedd1 100644 --- a/activerecord/test/models/reply.rb +++ b/activerecord/test/models/reply.rb @@ -4,12 +4,13 @@ class Reply < Topic named_scope :base belongs_to :topic, :foreign_key => "parent_id", :counter_cache => true + belongs_to :topic_with_primary_key, :class_name => "Topic", :primary_key => "title", :foreign_key => "parent_title", :counter_cache => "replies_count" has_many :replies, :class_name => "SillyReply", :dependent => :destroy, :foreign_key => "parent_id" validate :errors_on_empty_content validate_on_create :title_is_wrong_create - attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read + attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read, :parent_title validate :check_empty_title validate_on_create :check_content_mismatch |