Class: TentD::Model::Permission

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/tentd/model/permission.rb

Class Method Summary collapse

Class Method Details

.copy(from, to) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/tentd/model/permission.rb', line 18

def self.copy(from, to)
  from.permissions.each do |permission|
    attrs = permission.attributes
    attrs.delete(:id)
    to.permissions.create(attrs)
  end
  to.update(:public => from.public)
end