Class: RailsFields::EnforceFieldsMiddleware
- Inherits:
-
Object
- Object
- RailsFields::EnforceFieldsMiddleware
- Defined in:
- lib/rails_fields/enforce_fields_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ EnforceFieldsMiddleware
constructor
A new instance of EnforceFieldsMiddleware.
Constructor Details
#initialize(app) ⇒ EnforceFieldsMiddleware
Returns a new instance of EnforceFieldsMiddleware.
3 4 5 |
# File 'lib/rails_fields/enforce_fields_middleware.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/rails_fields/enforce_fields_middleware.rb', line 7 def call(env) ApplicationRecord.descendants.each do |model| model.enforce_declared_fields # if model.respond_to?(:enforce_declared_fields) end @app.call(env) end |