Module: Cyrax::Extensions::HasResource
- Extended by:
- ActiveSupport::Concern
- Included in:
- Resource
- Defined in:
- lib/cyrax/extensions/has_resource.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #resource_attributes ⇒ Object
-
#resource_class ⇒ Object
Returns the resource class as a constant - e.g.
-
#resource_scope ⇒ Object
Returns the resource class - e.g.
- #response_name ⇒ Object
Instance Method Details
#resource_attributes ⇒ Object
34 35 36 |
# File 'lib/cyrax/extensions/has_resource.rb', line 34 def resource_attributes filter_attributes(dirty_resource_attributes) end |
#resource_class ⇒ Object
Returns the resource class as a constant - e.g. Product
13 14 15 16 17 18 19 |
# File 'lib/cyrax/extensions/has_resource.rb', line 13 def resource_class if self.resource_class_name self.resource_class_name.constantize else resource_name.classify.constantize end end |
#resource_scope ⇒ Object
Returns the resource class - e.g. Product If you want your resource to return something interesting, you should override this in your resource by defining the method and returning your own scope
30 31 32 |
# File 'lib/cyrax/extensions/has_resource.rb', line 30 def resource_scope resource_class end |
#response_name ⇒ Object
38 39 40 |
# File 'lib/cyrax/extensions/has_resource.rb', line 38 def response_name resource_name end |