Class: CollectiveIdea::Acts::NestedSet::SetValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/awesome_nested_set/set_validator.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


12
13
14
# File 'lib/awesome_nested_set/set_validator.rb', line 12

def valid?
  query.count == 0
end