Module: Cyrax::Extensions::HasResource::ClassMethods
- Defined in:
- lib/cyrax/extensions/has_resource.rb
Instance Method Summary collapse
-
#accessible_attributes(*attrs) ⇒ Object
Class method for setting all the attributes that you want to access in the resource.
-
#resource(name, options = {}) ⇒ Object
Class method for setting the resource that you want to access.
Instance Method Details
#accessible_attributes(*attrs) ⇒ Object
Class method for setting all the attributes that you want to access in the resource
37 38 39 40 41 42 43 44 |
# File 'lib/cyrax/extensions/has_resource.rb', line 37 def accessible_attributes(*attrs) if attrs.blank? @accessible_attributes || [] else @accessible_attributes ||= [] @accessible_attributes += attrs end end |
#resource(name, options = {}) ⇒ Object
Class method for setting the resource that you want to access
53 54 55 56 57 58 59 60 61 |
# File 'lib/cyrax/extensions/has_resource.rb', line 53 def resource(name, = {}) if [:class_name].present? ActiveSupport::Deprecation.warn "sending :class_name in #resource method is deprecated. send :class instead" [:class] = [:class_name].to_s.constantize end self._resource_name = name.to_s self._resource_class = [:class] self._collection_name = name.to_s.pluralize end |