Module: ActsAsRecursiveTree::Options::Values
- Defined in:
- lib/acts_as_recursive_tree/options/values.rb
Defined Under Namespace
Classes: ActiveRecord, Base, MultiValue, RangeValue, Relation, SingleValue
Class Method Summary collapse
Class Method Details
.create(value, config = nil) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/acts_as_recursive_tree/options/values.rb', line 67 def self.create(value, config = nil) klass = case value when ::Numeric, ::String SingleValue when ::ActiveRecord::Relation Relation when Range RangeValue when Enumerable MultiValue when ::ActiveRecord::Base ActiveRecord else raise "#{value.class} is not supported" end klass.new(value, config) end |