Sha256: d8eacdf96b46f3fdd75cb34771fd46f4d916e9d3e7475531526cc86c24fb210d

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

# frozen_string_literal: true

class <%= permission_c %> < ActiveRecord::Base
  has_and_belongs_to_many :related_roles,
                          join_table: '<%= role_pms_tb %>', foreign_key: :<%= permission_u %>_id,
                          class_name: '<%= role_c %>', association_foreign_key: :<%= role_u %>_id
<% unless @ii_opts[:without_group] %>
  has_and_belongs_to_many :related_role_groups,
                          join_table: '<%= group_pms_tb %>', foreign_key: :<%= permission_u %>_id,
                          class_name: '<%= group_c %>', association_foreign_key: :<%= group_u %>_id
<% end %>
  belongs_to :resource, polymorphic: true

  acts_as_permission
end

__END__

  string  :action,     null: false
  string  :obj_type
  integer :obj_id
  string  :desc

  index %i[ action obj_type obj_id ], unique: true

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
i_am_i_can-4.4.1 lib/generators/i_am_i_can/templates/models/permission.erb
i_am_i_can-4.4.0 lib/generators/i_am_i_can/templates/models/permission.erb