Class: Upfluence::Utils::Thrift::Middleware::ActiveRecord
- Inherits:
-
Object
- Object
- Upfluence::Utils::Thrift::Middleware::ActiveRecord
- Defined in:
- lib/upfluence/utils/thrift/middleware/active_record.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(app) ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
9 10 11 |
# File 'lib/upfluence/utils/thrift/middleware/active_record.rb', line 9 def initialize(app) @app = app end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/upfluence/utils/thrift/middleware/active_record.rb', line 13 def method_missing(method, *args, &block) @app.send(method, *args, &block) rescue ::ActiveRecord::RecordInvalid => e raise Base::Exceptions::ValidationError.from_model(e.record) rescue ::ActiveRecord::RecordNotFound raise Base::Exceptions::NotFound end |