I've been trying all day to make this work. I want to define the
collection_serialization_options method so I will be able to send more
information when the /api/orders call is made. What I've done is:
- Create a new extension: script/generate extension ReporterApi
- Create a new file called orders_controller.rb under vendor/
extensions/reporter_api/controllers/api . This should override the
existing one right?
- The new code I've used for this file is the following:
class Api::OrdersController < Api::BaseController
resource_controller_for_api
actions :index, :show
private
def collection_serialization_options
{ :include => {:ship_address, :bill_address, :line_items} }
end
def object_serialization_options
{ :include => {
:bill_address => {},
:ship_address => {},
:shipments => {:include => [:shipping_method, :address]},
:line_items => {:include => [:variant]}
}
}
end
end
Any idea how can I solve this?
Thanks in advance
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
No comments:
Post a Comment