From 5c245b91d2dbc0b300e8193310b3f950d0cf6c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 10 May 2010 12:28:38 +0300 Subject: Make sure valid? preceives the context as in ActiveModel API (ht: Carlos Antonio) --- activerecord/test/models/reply.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb index 264a49b465..6cc9ee038a 100644 --- a/activerecord/test/models/reply.rb +++ b/activerecord/test/models/reply.rb @@ -17,6 +17,7 @@ class WrongReply < Reply validate :check_empty_title validate :check_content_mismatch, :on => :create validate :check_wrong_update, :on => :update + validate :check_title_is_secret, :on => :special_case def check_empty_title errors[:title] << "Empty" unless attribute_present?("title") @@ -39,6 +40,10 @@ class WrongReply < Reply def check_wrong_update errors[:title] << "is Wrong Update" if attribute_present?("title") && title == "Wrong Update" end + + def check_title_is_secret + errors[:title] << "Invalid" unless title == "secret" + end end class SillyReply < Reply -- cgit v1.2.3 From 3436fdfc12d58925e3d981e0afa61084ea34736c Mon Sep 17 00:00:00 2001 From: Diego Algorta Date: Sat, 15 May 2010 12:33:18 -0300 Subject: Fix for get_ids when including a belongs_to association on a has_many association [#2896 state:resolved] Signed-off-by: Pratik Naik --- activerecord/test/models/post.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index d092c4bf09..dd06822cfd 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -69,6 +69,7 @@ class Post < ActiveRecord::Base has_many :authors, :through => :categorizations has_many :readers + has_many :readers_with_person, :include => :person, :class_name => "Reader" has_many :people, :through => :readers has_many :people_with_callbacks, :source=>:person, :through => :readers, :before_add => lambda {|owner, reader| log(:added, :before, reader.first_name) }, -- cgit v1.2.3