aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/company.rb5
-rw-r--r--activerecord/test/models/reply.rb8
-rw-r--r--activerecord/test/models/topic.rb2
3 files changed, 10 insertions, 5 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index ab09f88a9f..9242c209ea 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -111,6 +111,8 @@ class Client < Company
true
end
+ before_destroy :overwrite_to_raise
+
# Used to test that read and question methods are not generated for these attributes
def ruby_type
read_attribute :ruby_type
@@ -120,6 +122,9 @@ class Client < Company
query_attribute :rating
end
+ def overwrite_to_raise
+ end
+
class << self
private
diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb
index f5906dedd1..ba5a1d1d01 100644
--- a/activerecord/test/models/reply.rb
+++ b/activerecord/test/models/reply.rb
@@ -8,13 +8,13 @@ class Reply < Topic
has_many :replies, :class_name => "SillyReply", :dependent => :destroy, :foreign_key => "parent_id"
validate :errors_on_empty_content
- validate_on_create :title_is_wrong_create
+ validate :title_is_wrong_create, :on => :create
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
- validate_on_update :check_wrong_update
+ validate :check_content_mismatch, :on => :create
+ validate :check_wrong_update, :on => :update
def check_empty_title
errors[:title] << "Empty" unless attribute_present?("title")
@@ -47,4 +47,4 @@ module Web
class Reply < Web::Topic
belongs_to :topic, :foreign_key => "parent_id", :counter_cache => true, :class_name => 'Web::Topic'
end
-end \ No newline at end of file
+end
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb
index 9594dc300a..c16a6f2be9 100644
--- a/activerecord/test/models/topic.rb
+++ b/activerecord/test/models/topic.rb
@@ -77,4 +77,4 @@ module Web
class Topic < ActiveRecord::Base
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id", :class_name => 'Web::Reply'
end
-end \ No newline at end of file
+end