Module: Caprese::Record::Aliasing
- Extended by:
- ActiveSupport::Concern
- Included in:
- Caprese::Record
- Defined in:
- lib/caprese/record/aliasing.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#caprese_is_attribute?(attribute_name) ⇒ Boolean
Provides an intermediary helper method on records that defines non-column attributes for records.
-
#caprese_is_field?(field) ⇒ Boolean
Checks that any field provided is either an attribute on the record, or an aliased field, or none.
Instance Method Details
#caprese_is_attribute?(attribute_name) ⇒ Boolean
Note:
This exists so there is a method by which to state that a non-column attribute should have an error source pointer like ‘/data/attributes/` instead of `/data/relationships/`
Provides an intermediary helper method on records that defines non-column attributes for records
11 12 13 |
# File 'lib/caprese/record/aliasing.rb', line 11 def caprese_is_attribute?(attribute_name) false end |
#caprese_is_field?(field) ⇒ Boolean
Checks that any field provided is either an attribute on the record, or an aliased field, or none
19 20 21 |
# File 'lib/caprese/record/aliasing.rb', line 19 def caprese_is_field?(field) respond_to?(field = field.to_sym) || caprese_is_attribute?(field) || self.class.caprese_field_aliases[field] end |