From eb04408a20628a49296e0859425940b39a83ec63 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 23 Jun 2010 10:05:30 -0400 Subject: ActiveRecord's relation object should respond to to_json and to_yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#4547 state:resolved] Signed-off-by: José Valim --- activerecord/lib/active_record/relation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation.rb') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 66970a5ea1..a342b1fe6f 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -10,7 +10,7 @@ module ActiveRecord include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches - delegate :length, :collect, :map, :each, :all?, :include?, :to => :to_a + delegate :to_json, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a delegate :insert, :to => :arel attr_reader :table, :klass -- cgit v1.2.3 From 0bf3baa6b3d216c6340f8d3b5d0a3ebc093e969a Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 23 Jun 2010 11:54:38 -0400 Subject: adding fix for to_xml for ActiveRecord relation object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/lib/active_record/relation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation.rb') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index a342b1fe6f..a51b317dc3 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -10,7 +10,7 @@ module ActiveRecord include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches - delegate :to_json, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a + delegate :to_xml, :to_json, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a delegate :insert, :to => :arel attr_reader :table, :klass -- cgit v1.2.3 From 47134a04bbce216f9c31473b1a0c1a077d624692 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 25 Jun 2010 20:31:10 -0300 Subject: blocks removed from all the ActiveRelation query_methods, extend method added instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/lib/active_record/relation.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord/lib/active_record/relation.rb') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index a51b317dc3..fd0660a138 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -328,6 +328,15 @@ module ActiveRecord to_a.inspect end + def extend(*args, &block) + if block_given? + apply_modules Module.new(&block) + self + else + super + end + end + protected def method_missing(method, *args, &block) -- cgit v1.2.3