aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures/developer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/fixtures/developer.rb')
-rw-r--r--activerecord/test/fixtures/developer.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/developer.rb b/activerecord/test/fixtures/developer.rb
index c868cddecd..20005ed04e 100644
--- a/activerecord/test/fixtures/developer.rb
+++ b/activerecord/test/fixtures/developer.rb
@@ -41,8 +41,18 @@ class Developer < ActiveRecord::Base
has_and_belongs_to_many :special_projects, :join_table => 'developers_projects', :association_foreign_key => 'project_id'
+ has_many :audit_logs
+
validates_inclusion_of :salary, :in => 50000..200000
validates_length_of :name, :within => 3..20
+
+ before_create do |developer|
+ developer.audit_logs.build :message => "Computer created"
+ end
+end
+
+class AuditLog < ActiveRecord::Base
+ belongs_to :developer
end
DeveloperSalary = Struct.new(:amount)