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
6 7 8 |
# File 'lib/haveapi/model_adapters/active_record.rb', line 6 def self.handle?(layout, klass) klass < ::ActiveRecord::Base && i(object object_list).include?(layout) end |
.load_validators(model, params) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/haveapi/model_adapters/active_record.rb', line 10 def self.load_validators(model, params) tr = ValidatorTranslator.new(params.params) model.validators.each do |validator| tr.translate(validator) end end |