Sha256: 1e3a6786150ba6f6828358d98d7da7e0cd1561332919e40f12fe69e22544758d

Contents?: true

Size: 824 Bytes

Versions: 19

Compression:

Stored size: 824 Bytes

Contents

require 'active_support/concern'

module Cms
  module Fortress
    module SiteMethods
      extend ActiveSupport::Concern

      included do
        after_create :generate_defaults

        has_many :users, class_name: "Cms::Fortress::User", foreign_key: :site_id
        has_many :roles, class_name: "Cms::Fortress::Role", foreign_key: :site_id
        has_many :role_details, class_name: "Cms::Fortress::RoleDetail", foreign_key: :site_id
      end

      # generate default roles specific for the site
      def generate_defaults
        #TODO: implement I18n below
        role = Cms::Fortress::Role.create!(:site_id => id, :name => "#{label} Administrator", :description => "#{ label } administrator users")
        role.load_defaults
        role.save
      end

      module ClassMethods

      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cms-fortress-1.3.15 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.14 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.13 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.12 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.11 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.10 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.9 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.8 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.7 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.6 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.5 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.4 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.3 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.2 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.1 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.0 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.0.rc3 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.0.rc2 lib/cms/fortress/site_methods.rb
cms-fortress-1.3.0.rc1 lib/cms/fortress/site_methods.rb