Class: HaveAPI::ModelAdapters::ActiveRecord
- Inherits:
-
HaveAPI::ModelAdapter
- Object
- HaveAPI::ModelAdapter
- HaveAPI::ModelAdapters::ActiveRecord
- Defined in:
- lib/haveapi/model_adapters/active_record.rb
Overview
Adapter for ActiveRecord models.
Defined Under Namespace
Modules: Action Classes: Input, Output, ValidatorTranslator
Class Method Summary collapse
Methods inherited from HaveAPI::ModelAdapter
for, input, input_clean, output, register, used_by
Class Method Details
.handle?(layout, klass) ⇒ Boolean
8 9 10 |
# File 'lib/haveapi/model_adapters/active_record.rb', line 8 def self.handle?(layout, klass) klass < ::ActiveRecord::Base && %i[object object_list].include?(layout) end |
.load_validators(model, params) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/haveapi/model_adapters/active_record.rb', line 12 def self.load_validators(model, params) tr = ValidatorTranslator.new(params.params) model.validators.each do |validator| tr.translate(validator) end end |