mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Simply delegate as_json
to records
This commit is contained in:
parent
c8c1460f7a
commit
4368dba5ee
3 changed files with 2 additions and 6 deletions
|
@ -261,10 +261,6 @@ module ActiveRecord
|
|||
coder.represent_seq(nil, records)
|
||||
end
|
||||
|
||||
def as_json(options = nil) #:nodoc:
|
||||
records.as_json(options)
|
||||
end
|
||||
|
||||
# Returns size of the records.
|
||||
def size
|
||||
loaded? ? @records.length : count(:all)
|
||||
|
|
|
@ -38,7 +38,7 @@ module ActiveRecord
|
|||
|
||||
delegate :to_xml, :encode_with, :length, :collect, :map, :each, :all?, :include?, :to_ary, :join,
|
||||
:[], :&, :|, :+, :-, :sample, :reverse, :compact, :in_groups, :in_groups_of,
|
||||
:to_sentence, :to_formatted_s,
|
||||
:to_sentence, :to_formatted_s, :as_json,
|
||||
:shuffle, :split, :index, to: :records
|
||||
|
||||
delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key,
|
||||
|
|
|
@ -33,7 +33,7 @@ module ActiveRecord
|
|||
:map, :none?, :one?, :partition, :reject, :reverse,
|
||||
:sample, :second, :sort, :sort_by, :third,
|
||||
:to_ary, :to_set, :to_xml, :to_yaml, :join,
|
||||
:in_groups, :in_groups_of, :to_sentence, :to_formatted_s
|
||||
:in_groups, :in_groups_of, :to_sentence, :to_formatted_s, :as_json
|
||||
]
|
||||
|
||||
ARRAY_DELEGATES.each do |method|
|
||||
|
|
Loading…
Reference in a new issue