Module: Restful::Extensions
- Defined in:
- lib/restful.rb
Instance Method Summary collapse
-
#restful(*args, &block) ⇒ Object
Restfully serialize an activerecord object, association or a plain array of activerecord objects.
Instance Method Details
#restful(*args, &block) ⇒ Object
Restfully serialize an activerecord object, association or a plain array of activerecord objects. The web service name must be specified as registered via Restful.register_web_service, unless there is only one registered service.
A final hash of options will be passed on to the serializer for configuration.
If a block is given, the serializer’s Restful::Configuration::Resource configuration object will be exposed for fine grained configuration.
166 167 168 169 170 171 172 |
# File 'lib/restful.rb', line 166 def restful(*args, &block) = args. web_service_name = args.shift web_service = Restful.web_service_configuration(web_service_name) web_service ||= Restful.registered_web_services.values.first if Restful.registered_web_services.size == 1 Restful::Serializer.new(self, web_service, , &block).serialize end |