Module: Scalingo::Endpoint::ClassMethods
- Included in:
- Scalingo::Endpoint
- Defined in:
- lib/scalingo/endpoint.rb
Instance Method Summary collapse
Instance Method Details
#resources(name, opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/scalingo/endpoint.rb', line 10 def resources(name, opts = {}) name = name.to_s define_method(name.pluralize.underscore) do Scalingo::Endpoint.const_get(name.pluralize.camelize).new(self) end return if opts[:collection_only] define_method(name.singularize.underscore) do |id| send(name.pluralize.underscore).find(id) end end |