Ticket #9640: fix_nested_includes2.patch
| File fix_nested_includes2.patch, 1.3 kB (added by blweiner, 4 months ago) |
|---|
-
avatar.rb
old new 1 class Avatar < ActiveRecord::Base 2 3 belongs_to :picture 4 5 end -
developer.rb
old new 42 42 has_and_belongs_to_many :special_projects, :join_table => 'developers_projects', :association_foreign_key => 'project_id' 43 43 44 44 has_many :audit_logs 45 46 has_one :picture 45 47 46 48 validates_inclusion_of :salary, :in => 50000..200000 47 49 validates_length_of :name, :within => 3..20 -
picture.rb
old new 1 class Picture < ActiveRecord::Base 2 3 has_one :large_avatar, :class_name => 'Avatar', :conditions => { :thumbnail => 'large' }, :dependent => :destroy 4 has_one :small_avatar, :class_name => 'Avatar', :conditions => { :thumbnail => 'small' }, :dependent => :destroy 5 belongs_to :developer 6 7 def after_create 8 create_large_avatar :filename => "large_#{self.filename}", :thumbnail => 'large' 9 create_small_avatar :filename => "small_#{self.filename}", :thumbnail => 'small' 10 end 11 12 end