diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-08 04:36:37 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-08 04:36:37 +0000 |
commit | 5298f730bb181fb0f34e2bc641bed3a0c5abb6dd (patch) | |
tree | 80d54a4361a6233e5cf7a86516389f8fd79f178b /activerecord/test | |
parent | b661c9603a3d053f940e50fc1b63ff568f9b98f8 (diff) | |
download | rails-5298f730bb181fb0f34e2bc641bed3a0c5abb6dd.tar.gz rails-5298f730bb181fb0f34e2bc641bed3a0c5abb6dd.tar.bz2 rails-5298f730bb181fb0f34e2bc641bed3a0c5abb6dd.zip |
Add :order option to Author.posts_with_comments_and_categories so that tests which assume implicit id order pass with database which do not provide it. Scrubbed whitespace.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2934 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/fixtures/author.rb | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb index c183940c2f..e98d15e37a 100644 --- a/activerecord/test/fixtures/author.rb +++ b/activerecord/test/fixtures/author.rb @@ -2,45 +2,45 @@ class Author < ActiveRecord::Base has_many :posts has_many :posts_with_comments, :include => :comments, :class_name => "Post" has_many :posts_with_categories, :include => :categories, :class_name => "Post" - has_many :posts_with_comments_and_categories, :include => [ :comments, :categories ], :class_name => "Post" + has_many :posts_with_comments_and_categories, :include => [ :comments, :categories ], :order => "posts.id", :class_name => "Post" has_many :posts_with_callbacks, :class_name => "Post", :before_add => :log_before_adding, - :after_add => :log_after_adding, :before_remove => :log_before_removing, - :after_remove => :log_after_removing - has_many :posts_with_proc_callbacks, :class_name => "Post", + :after_add => :log_after_adding, :before_remove => :log_before_removing, + :after_remove => :log_after_removing + has_many :posts_with_proc_callbacks, :class_name => "Post", :before_add => Proc.new {|o, r| o.post_log << "before_adding#{r.id}"}, - :after_add => Proc.new {|o, r| o.post_log << "after_adding#{r.id}"}, - :before_remove => Proc.new {|o, r| o.post_log << "before_removing#{r.id}"}, - :after_remove => Proc.new {|o, r| o.post_log << "after_removing#{r.id}"} - has_many :posts_with_multiple_callbacks, :class_name => "Post", + :after_add => Proc.new {|o, r| o.post_log << "after_adding#{r.id}"}, + :before_remove => Proc.new {|o, r| o.post_log << "before_removing#{r.id}"}, + :after_remove => Proc.new {|o, r| o.post_log << "after_removing#{r.id}"} + has_many :posts_with_multiple_callbacks, :class_name => "Post", :before_add => [:log_before_adding, Proc.new {|o, r| o.post_log << "before_adding_proc#{r.id}"}], - :after_add => [:log_after_adding, Proc.new {|o, r| o.post_log << "after_adding_proc#{r.id}"}] + :after_add => [:log_after_adding, Proc.new {|o, r| o.post_log << "after_adding_proc#{r.id}"}] has_many :unchangable_posts, :class_name => "Post", :before_add => :raise_exception, :after_add => :log_after_adding attr_accessor :post_log def after_initialize - @post_log = [] + @post_log = [] end private - def log_before_adding(object) - @post_log << "before_adding#{object.id}" - end - - def log_after_adding(object) - @post_log << "after_adding#{object.id}" - end - - def log_before_removing(object) - @post_log << "before_removing#{object.id}" - end - - def log_after_removing(object) - @post_log << "after_removing#{object.id}" - end - - def raise_exception(object) - raise Exception.new("You can't add a post") - end -end
\ No newline at end of file + def log_before_adding(object) + @post_log << "before_adding#{object.id}" + end + + def log_after_adding(object) + @post_log << "after_adding#{object.id}" + end + + def log_before_removing(object) + @post_log << "before_removing#{object.id}" + end + + def log_after_removing(object) + @post_log << "after_removing#{object.id}" + end + + def raise_exception(object) + raise Exception.new("You can't add a post") + end +end |