Module: ApiRecord::Base
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Attributes, ActiveModel::Model, ActiveModel::Serializers::JSON
- Included in:
- All, Destroyable, Findable, Indexable, Saveable
- Defined in:
- lib/api_record/base.rb
Instance Method Summary collapse
Instance Method Details
#has_error? ⇒ Boolean
81 82 83 |
# File 'lib/api_record/base.rb', line 81 def has_error? errors.any? end |
#inspect ⇒ Object
75 76 77 78 79 |
# File 'lib/api_record/base.rb', line 75 def inspect attributes_to_display = self.class.attribute_names.map(&:to_s) + ['response'] attributes_string = attributes_to_display.map { |attr| "#{attr}: #{send(attr).inspect}" }.join(', ') "#<#{self.class.name} #{attributes_string}>" end |
#validate! ⇒ Object
85 86 87 |
# File 'lib/api_record/base.rb', line 85 def validate! raise RecordInvalidError.new(self) unless valid? end |