Skip to content

Commit

Permalink
Collection method should kick the object into an array
Browse files Browse the repository at this point in the history
  • Loading branch information
nesquena committed Apr 14, 2011
1 parent f848f4c commit 7b7d3c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rabl/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ def to_xml(options={})
def object(data)
@_data = data unless @_locals[:object]
end
alias_method :collection, :object

# Sets the object as a collection casted to a simple array
# collection @users
def collection(data)
object(data.to_a)
end

# Indicates an attribute or method should be included in the json output
# attribute :foo, :as => "bar"
Expand Down

0 comments on commit 7b7d3c2

Please sign in to comment.