Module: StoreModel::CombineErrorsStrategies
- Defined in:
- lib/store_model/combine_errors_strategies.rb,
lib/store_model/combine_errors_strategies/merge_error_strategy.rb,
lib/store_model/combine_errors_strategies/mark_invalid_error_strategy.rb
Defined Under Namespace
Classes: MarkInvalidErrorStrategy, MergeErrorStrategy
Class Method Summary collapse
-
.configure(options) ⇒ Object
Finds a strategy based on options and global config.
Class Method Details
.configure(options) ⇒ Object
Finds a strategy based on options and global config
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/store_model/combine_errors_strategies.rb', line 11 def configure() configured_strategy = [:merge_errors] || StoreModel.config.merge_errors if configured_strategy.respond_to?(:call) configured_strategy elsif configured_strategy == true StoreModel::CombineErrorsStrategies::MergeErrorStrategy.new elsif configured_strategy.nil? StoreModel::CombineErrorsStrategies::MarkInvalidErrorStrategy.new else const_get(configured_strategy.to_s.camelize).new end end |