Class: Perus::Server::Group

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/perus/server/models/group.rb

Instance Method Summary collapse

Instance Method Details

#after_destroyObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/perus/server/models/group.rb', line 12

def after_destroy
    super

    # rather than deleting all systems in a group, each system in the
    # group is just removed from the group instead. this is better than
    # accidentally removing a group and all related system data.
    systems.each do |system|
        system.group_id = nil
        system.save
    end
end

#validateObject



6
7
8
9
10
# File 'lib/perus/server/models/group.rb', line 6

def validate
    super
    validates_presence  :name
    validates_unique    :name
end