Sha256: 480ed6078d56d6dc807a54a62c791603956c7ea4d2d4faeb21a136b21979b08e

Contents?: true

Size: 874 Bytes

Versions: 36

Compression:

Stored size: 874 Bytes

Contents

module Spider; module Master
    
    class Customer < Spider::Model::Managed
        element :name, String
        element :uuid, UUID
        element :public_key, Text
        element :private_key, Text
        multiple_choice :admins, Master::Admin, :add_multiple_reverse => {:name => :customers, :association => :multiple_choice} do
            element :receive_notifications, Bool, :default => true
            element :manage_plugins, Bool, :default => true
        end
        
        with_mapper do
            
            def before_save(obj, mode)
                if mode == :insert
                    global = Admin.where(:global => true)
                    global.each do |adm|
                        obj.admins << adm
                    end
                end
                super
            end
            
        end
        
    end
    
end; end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
spiderfw-0.6.21 apps/master/models/customer.rb
spiderfw-0.6.20 apps/master/models/customer.rb
spiderfw-0.6.19 apps/master/models/customer.rb
spiderfw-0.6.18 apps/master/models/customer.rb
spiderfw-0.6.17 apps/master/models/customer.rb
spiderfw-0.6.16 apps/master/models/customer.rb
spiderfw-0.6.15 apps/master/models/customer.rb
spiderfw-0.6.14 apps/master/models/customer.rb
spiderfw-0.6.13 apps/master/models/customer.rb
spiderfw-0.6.12 apps/master/models/customer.rb
spiderfw-0.6.11 apps/master/models/customer.rb
spiderfw-0.6.10 apps/master/models/customer.rb
spiderfw-0.6.9 apps/master/models/customer.rb
spiderfw-0.6.8 apps/master/models/customer.rb
spiderfw-0.6.7 apps/master/models/customer.rb
spiderfw-0.6.6 apps/master/models/customer.rb