Sha256: a61c14847d2bbd0111207aeefe453556c312989651a496d129408512f6376de9

Contents?: true

Size: 945 Bytes

Versions: 4

Compression:

Stored size: 945 Bytes

Contents

class <%= role_c %> < ActiveRecord::Base
  has_and_belongs_to_many :related_users,
                          join_table: '<%= subj_role_tb %>', foreign_key: :<%= role_u %>_id,
                          class_name: '<%= name_c %>', association_foreign_key: :<%= name_u %>_id
<% unless @ii_opts[:without_group] %>
  has_and_belongs_to_many :related_groups,
                          join_table: '<%= group_role_tb %>', foreign_key: :<%= role_u %>_id,
                          class_name: '<%= group_c %>', association_foreign_key: :<%= group_u %>_id
<% end %>
  has_and_belongs_to_many :permissions,
                          join_table: '<%= role_pms_tb %>', foreign_key: :<%= role_u %>_id,
                          class_name: '<%= permission_c %>', association_foreign_key: :<%= permission_u %>_id

  acts_as_role

  # default_scope { with_permissions }
end

__END__

  string  :name, null: false
  string  :desc

  index :name, unique: true

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i_am_i_can-4.3.3 lib/generators/i_am_i_can/templates/models/role.erb
i_am_i_can-4.3.2 lib/generators/i_am_i_can/templates/models/role.erb
i_am_i_can-4.3.1 lib/generators/i_am_i_can/templates/models/role.erb
i_am_i_can-4.3.0 lib/generators/i_am_i_can/templates/models/role.erb