Sha256: ad88672a1e3ab84b419de8939fc73183548144190e86ac6077f40514bd04213e

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

class Cms::Fortress::Role < ActiveRecord::Base
  # set_table_name :cms_fortress_roles
  self.table_name = "cms_fortress_roles"
  # attr_accessible :description, :name
  has_many :users
  has_many :role_details

  def load_defaults
    file = File.expand_path(File.join(File.dirname(__FILE__), "../../../../", "config", "roles.yml"))
    data = YAML.load_file(file)

    data.each do |k,v|
      role_details.build(:name => k.humanize, :command => k, :can_create => false, :can_update => false, :can_delete => false, :can_view => true)
      v.each {|m| role_details.build(:name => m.humanize, :command => "#{k}.#{m}", :can_create => true, :can_update => true, :can_delete => true, :can_view => true) }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cms-fortress-1.0.3 app/models/cms/fortress/role.rb
cms-fortress-1.0.2 app/models/cms/fortress/role.rb
cms-fortress-1.0.1 app/models/cms/fortress/role.rb
cms-fortress-1.0.0 app/models/cms/fortress/role.rb