lib/roar/rails/responder.rb in roar-rails-0.0.5 vs lib/roar/rails/responder.rb in roar-rails-0.0.6
- old
+ new
@@ -15,16 +15,18 @@
module Responder
include ModelMethods
def display(model, given_options={})
# TODO: remove the [] semantics, this should be done with a Collection representer.
+ representer = options.delete(:with_representer)
+
if model.respond_to?(:map!)
- model.map! do |r|
- extend_with_representer!(r)
- r.to_hash
+ model.map! do |m|
+ extend_with_representer!(m, representer)
+ m.to_hash
end
else
- extend_with_representer!(model, options.delete(:with_representer))
+ extend_with_representer!(model, representer)
end
super
end
end
end