Remove unnecessary code
This commit is contained in:
parent
02bd924e6a
commit
ecedae273e
4 changed files with 6 additions and 10 deletions
|
@ -45,6 +45,10 @@ Rails:
|
||||||
Rails/BulkChangeTable:
|
Rails/BulkChangeTable:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/HasAndBelongsToMany:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/role.rb'
|
||||||
|
|
||||||
Rails/LexicallyScopedActionFilter:
|
Rails/LexicallyScopedActionFilter:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/application_controller.rb'
|
- 'app/controllers/application_controller.rb'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
rolify role_join_table_name: 'account_roles'
|
rolify role_join_table_name: :account_roles
|
||||||
|
|
||||||
has_one :user, dependent: :restrict_with_exception
|
has_one :user, dependent: :restrict_with_exception
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class AccountRole < ApplicationRecord
|
|
||||||
belongs_to :account
|
|
||||||
belongs_to :role
|
|
||||||
end
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Role < ApplicationRecord
|
class Role < ApplicationRecord
|
||||||
has_many :account_roles, dependent: :destroy
|
has_and_belongs_to_many :accounts, join_table: :account_roles
|
||||||
|
|
||||||
has_many :accounts, through: :account_roles, source: :account
|
|
||||||
|
|
||||||
belongs_to :resource, polymorphic: true, optional: true
|
belongs_to :resource, polymorphic: true, optional: true
|
||||||
|
|
||||||
|
|
Reference in a new issue