Skip to content

Multiple enum_attr's and annotate gem #56

@jgrocho

Description

@jgrocho

Given a model that looks like

class user < ActiveRecord::Base
    enum_attr :status %w{suspended pending approved}
    enum_attr :role %w{regular moderator admin}
end

When attempting to run annotate on that model,
Then I get the following error

Unable to annotate user.rb: #<MetaProgramming::AliasMethodChainError: method_missing_without_enumerated_attribute already exists.  Circular references not permitted.>

Nothing annotated.

I seem to have narrowed it down to the fact that enum_attr is being used twice in the model. Removing (or commenting out) one or both allows the model to be annotated as expected, even when both enums are defined in the migration. My guess is that method_missing_without_enumerated_attribute is being defined each time enum_attr is used, but I don't know enough about the internals of enumerated_attribute to determine this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions