Skip to content

Resourcify requires additional parameters if custom table names are used #601

Open
@jussihirvi

Description

@jussihirvi

I installed rolify with custom classes by saying
rails g rolify:role AdminRole AdminUser
All well so far. The model AdminUser had
rolify :role_cname => 'AdminRole'

I wanted to resourcify my model Company. It worked well with just adding resourcify.

But I couldn't delete companies. I got following error message:

Missing model class Role for the Company#roles association. (NameError)
... active_record/inheritance.rb:266:in `compute_type': uninitialized constant Company::Role (NameError)

I looked at the resourcify source code in rolify.rb, and solved my problem by adding parameters to resourcify:

resourcify :admin_roles, { role_cname: 'AdminRole' }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions