Module: ViewModels::Extensions::ModelReader
- Included in:
- Base
- Defined in:
- lib/view_models/extensions/model_reader.rb
Overview
Model Reader extension. Allows to define model readers on view models, accessing attributes and methods on models
Defined Under Namespace
Classes: FilteredDelegationInstaller, Options
Instance Method Summary (collapse)
-
- (Object) model_reader(*attributes_and_options)
Define a reader for a model attribute.
Instance Method Details
- (Object) model_reader(*attributes_and_options)
Define a reader for a model attribute. Acts as a filtered delegation to the model.
You may specify a :filter_through option that is either a symbol or an array of symbols. The return value from the model will be filtered through the functions (arity 1) and then passed back to the receiver.
27 28 29 30 |
# File 'lib/view_models/extensions/model_reader.rb', line 27 def model_reader * = Options.new * FilteredDelegationInstaller.new(self, ).install end |