diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-21 12:51:53 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-21 12:51:53 +0200 |
commit | 33048b6e2738ff73b612dbcb35955189221dfbd0 (patch) | |
tree | 7e32f6031199c1e7ee9a3e5a15789b5f568a565d /activerecord/test/models | |
parent | edda0bfe76fc9b2adcdb705665aaef2769e6ef03 (diff) | |
parent | 9d7aae710384fb5f04129c35b86c5ea5fb9d83a9 (diff) | |
download | rails-33048b6e2738ff73b612dbcb35955189221dfbd0.tar.gz rails-33048b6e2738ff73b612dbcb35955189221dfbd0.tar.bz2 rails-33048b6e2738ff73b612dbcb35955189221dfbd0.zip |
Solving merge conflicts.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 1 | ||||
-rw-r--r-- | activerecord/test/models/essay.rb | 3 | ||||
-rw-r--r-- | activerecord/test/models/reply.rb | 3 | ||||
-rw-r--r-- | activerecord/test/models/topic.rb | 1 |
5 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 0d9ee36b20..b844c7cce0 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -87,6 +87,8 @@ class Author < ActiveRecord::Base has_many :tags, :through => :posts # through has_many :through has_many :post_categories, :through => :posts, :source => :categories + has_one :essay, :primary_key => :name, :as => :writer + belongs_to :author_address, :dependent => :destroy belongs_to :author_address_extra, :dependent => :delete, :class_name => "AuthorAddress" diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 840527ddeb..22168468a6 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -88,6 +88,7 @@ class Client < Company belongs_to :firm_with_select, :class_name => "Firm", :foreign_key => "firm_id", :select => "id" belongs_to :firm_with_other_name, :class_name => "Firm", :foreign_key => "client_of" belongs_to :firm_with_condition, :class_name => "Firm", :foreign_key => "client_of", :conditions => ["1 = ?", 1] + belongs_to :firm_with_primary_key, :class_name => "Firm", :primary_key => "name", :foreign_key => "firm_name" belongs_to :readonly_firm, :class_name => "Firm", :foreign_key => "firm_id", :readonly => true # Record destruction so we can test whether firm.clients.clear has diff --git a/activerecord/test/models/essay.rb b/activerecord/test/models/essay.rb new file mode 100644 index 0000000000..6c28f5e49b --- /dev/null +++ b/activerecord/test/models/essay.rb @@ -0,0 +1,3 @@ +class Essay < ActiveRecord::Base + belongs_to :writer, :primary_key => :name, :polymorphic => true +end 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 diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 51012d22ed..201d96dcd7 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -39,6 +39,7 @@ class Topic < ActiveRecord::Base named_scope :by_rejected_ids, lambda {{ :conditions => { :id => all(:conditions => {:approved => false}).map(&:id) } }} has_many :replies, :dependent => :destroy, :foreign_key => "parent_id" + has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title" serialize :content before_create :default_written_on |