Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

Namespace rails belongs_to

1
Rails

I have the following configuration

module Account
class Permission <ApplicationRecord
end
end

module Account
class GroupPermission < ApplicationRecord
belongs_to: permission
end
end

Table: account_group_users
account_users_id bigint,
account_groups_id bigint,
Table: account_group_permissions
account_permissions_id bigint,
account_groups_id bigint,
When I try to access the Account :: GroupPermission instance and through it access Account :: Permission returns nil.

Only works if I specify class_name:

Hi Tiago, is this a typo?
belongs_to: permission
It should be belongs_to :permission

Join the discussion
Create an account Log in