module Caprese::Record::Aliasing
Public Instance Methods
caprese_is_attribute?(attribute_name)
click to toggle source
Provides an intermediary helper method on records that defines non-column attributes for records @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/[name]` instead of `/data/relationships/[name]`
# File lib/caprese/record/aliasing.rb, line 11 def caprese_is_attribute?(attribute_name) false end
caprese_is_field?(field)
click to toggle source
Checks that any field provided is either an attribute on the record, or an aliased field, or none
@param [String,Symbol] field the field to check for on this record @return [Boolean] whether or not the field is on the record
# 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