diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-18 07:27:03 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-18 07:27:03 +0000 |
commit | 43b81d01d0a175c76fea1cdad2484ceb64ca659b (patch) | |
tree | 1afa41720e50b5dd605e77cb6048ad58bb4332e8 /activerecord/test/fixtures/developer.rb | |
parent | 49794485b6629a04d7efe324d7c91c0845dbdc2f (diff) | |
download | rails-43b81d01d0a175c76fea1cdad2484ceb64ca659b.tar.gz rails-43b81d01d0a175c76fea1cdad2484ceb64ca659b.tar.bz2 rails-43b81d01d0a175c76fea1cdad2484ceb64ca659b.zip |
move assets and models
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures/developer.rb')
-rw-r--r-- | activerecord/test/fixtures/developer.rb | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/activerecord/test/fixtures/developer.rb b/activerecord/test/fixtures/developer.rb deleted file mode 100644 index 20005ed04e..0000000000 --- a/activerecord/test/fixtures/developer.rb +++ /dev/null @@ -1,72 +0,0 @@ -module DeveloperProjectsAssociationExtension - def find_most_recent - find(:first, :order => "id DESC") - end -end - -module DeveloperProjectsAssociationExtension2 - def find_least_recent - find(:first, :order => "id ASC") - end -end - -class Developer < ActiveRecord::Base - has_and_belongs_to_many :projects do - def find_most_recent - find(:first, :order => "id DESC") - end - end - - has_and_belongs_to_many :projects_extended_by_name, - :class_name => "Project", - :join_table => "developers_projects", - :association_foreign_key => "project_id", - :extend => DeveloperProjectsAssociationExtension - - has_and_belongs_to_many :projects_extended_by_name_twice, - :class_name => "Project", - :join_table => "developers_projects", - :association_foreign_key => "project_id", - :extend => [DeveloperProjectsAssociationExtension, DeveloperProjectsAssociationExtension2] - - has_and_belongs_to_many :projects_extended_by_name_and_block, - :class_name => "Project", - :join_table => "developers_projects", - :association_foreign_key => "project_id", - :extend => DeveloperProjectsAssociationExtension do - def find_least_recent - find(:first, :order => "id ASC") - end - end - - 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) -class DeveloperWithAggregate < ActiveRecord::Base - self.table_name = 'developers' - composed_of :salary, :class_name => 'DeveloperSalary', :mapping => [%w(salary amount)] -end - -class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base - self.table_name = 'developers' - has_and_belongs_to_many :projects, :join_table => 'developers_projects', :foreign_key => 'developer_id' - before_destroy :raise_if_projects_empty! - - def raise_if_projects_empty! - raise if projects.empty? - end -end |