Rails 2.3.3.1
Update to latest Rails. A little bit of jiggery-pokery is involved, since they neglected to re-include vendored Rack in this release.
This commit is contained in:
parent
329fafafce
commit
664552ac02
257 changed files with 4346 additions and 1682 deletions
|
@ -25,6 +25,8 @@ class Author < ActiveRecord::Base
|
|||
has_many :comments_with_order_and_conditions, :through => :posts, :source => :comments, :order => 'comments.body', :conditions => "comments.body like 'Thank%'"
|
||||
has_many :comments_with_include, :through => :posts, :source => :comments, :include => :post
|
||||
|
||||
has_many :thinking_posts, :class_name => 'Post', :conditions => { :title => 'So I was thinking' }, :dependent => :delete_all
|
||||
has_many :welcome_posts, :class_name => 'Post', :conditions => { :title => 'Welcome to the weblog' }
|
||||
|
||||
has_many :comments_desc, :through => :posts, :source => :comments, :order => 'comments.id DESC'
|
||||
has_many :limited_comments, :through => :posts, :source => :comments, :limit => 1
|
||||
|
@ -85,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"
|
||||
|
||||
|
|
14
vendor/rails/activerecord/test/models/company.rb
vendored
14
vendor/rails/activerecord/test/models/company.rb
vendored
|
@ -78,19 +78,13 @@ class DependentFirm < Company
|
|||
has_many :companies, :foreign_key => 'client_of', :order => "id", :dependent => :nullify
|
||||
end
|
||||
|
||||
class ExclusivelyDependentFirm < Company
|
||||
has_one :account, :foreign_key => "firm_id", :dependent => :delete
|
||||
has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'"
|
||||
has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.']
|
||||
has_many :dependent_hash_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => {:name => 'BigShot Inc.'}
|
||||
end
|
||||
|
||||
class Client < Company
|
||||
belongs_to :firm, :foreign_key => "client_of"
|
||||
belongs_to :firm_with_basic_id, :class_name => "Firm", :foreign_key => "firm_id"
|
||||
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
|
||||
|
@ -125,6 +119,12 @@ class Client < Company
|
|||
end
|
||||
end
|
||||
|
||||
class ExclusivelyDependentFirm < Company
|
||||
has_one :account, :foreign_key => "firm_id", :dependent => :delete
|
||||
has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'"
|
||||
has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.']
|
||||
has_many :dependent_hash_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => {:name => 'BigShot Inc.'}
|
||||
end
|
||||
|
||||
class SpecialClient < Client
|
||||
end
|
||||
|
|
|
@ -89,3 +89,13 @@ class DeveloperOrderedBySalary < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
class DeveloperCalledDavid < ActiveRecord::Base
|
||||
self.table_name = 'developers'
|
||||
default_scope :conditions => "name = 'David'"
|
||||
end
|
||||
|
||||
class DeveloperCalledJamis < ActiveRecord::Base
|
||||
self.table_name = 'developers'
|
||||
default_scope :conditions => { :name => 'Jamis' }
|
||||
end
|
||||
|
|
3
vendor/rails/activerecord/test/models/essay.rb
vendored
Normal file
3
vendor/rails/activerecord/test/models/essay.rb
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Essay < ActiveRecord::Base
|
||||
belongs_to :writer, :primary_key => :name, :polymorphic => true
|
||||
end
|
2
vendor/rails/activerecord/test/models/pet.rb
vendored
2
vendor/rails/activerecord/test/models/pet.rb
vendored
|
@ -1,5 +1,5 @@
|
|||
class Pet < ActiveRecord::Base
|
||||
set_primary_key :pet_id
|
||||
belongs_to :owner
|
||||
belongs_to :owner, :touch => true
|
||||
has_many :toys
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ class Project < ActiveRecord::Base
|
|||
:after_add => Proc.new {|o, r| o.developers_log << "after_adding#{r.id || '<new>'}"},
|
||||
:before_remove => Proc.new {|o, r| o.developers_log << "before_removing#{r.id}"},
|
||||
:after_remove => Proc.new {|o, r| o.developers_log << "after_removing#{r.id}"}
|
||||
has_and_belongs_to_many :well_payed_salary_groups, :class_name => "Developer", :group => "salary", :having => "SUM(salary) > 10000", :select => "SUM(salary) as salary"
|
||||
has_and_belongs_to_many :well_payed_salary_groups, :class_name => "Developer", :group => "developers.salary", :having => "SUM(salary) > 10000", :select => "SUM(salary) as salary"
|
||||
|
||||
attr_accessor :developers_log
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
def validate
|
||||
errors.add("title", "Empty") unless attribute_present? "title"
|
||||
|
|
|
@ -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
|
||||
|
|
2
vendor/rails/activerecord/test/models/toy.rb
vendored
2
vendor/rails/activerecord/test/models/toy.rb
vendored
|
@ -1,4 +1,6 @@
|
|||
class Toy < ActiveRecord::Base
|
||||
set_primary_key :toy_id
|
||||
belongs_to :pet
|
||||
|
||||
named_scope :with_name, lambda { |name| {:conditions => {:name => name}} }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue