Class: CollectiveIdea::Acts::NestedSet::SetValidator
- Inherits:
-
Object
- Object
- CollectiveIdea::Acts::NestedSet::SetValidator
- Defined in:
- lib/awesome_nested_set/set_validator.rb
Instance Method Summary collapse
-
#initialize(model) ⇒ SetValidator
constructor
A new instance of SetValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(model) ⇒ SetValidator
Returns a new instance of SetValidator.
6 7 8 9 10 |
# File 'lib/awesome_nested_set/set_validator.rb', line 6 def initialize(model) @model = model @scope = model.all @parent = arel_table.alias('parent') end |
Instance Method Details
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/awesome_nested_set/set_validator.rb', line 12 def valid? query.count == 0 end |