Skip to content

ArgumentError if the monetized attribute name contains hyphens #699

Open
@afdev82

Description

@afdev82

Hi all,

while trying to add a monetized attribute called 'custom_frame-price', I was getting the following error:

ArgumentError (Model already has a monetized attribute called 'custom_frame-price')

The error was misleading, I didn't understand why for a couple of hours, the reason was another error that was thrown before and it was not visible in the browser (only the last one was visible):

NameError (invalid attribute name `custom_frame-price_money_before_type_cast'):

I have tried then to rename the attribute without the hyphen and it worked.
Should we add a warning in the README about that? Something like "WARNING: Do not use hyphens in the name of the attribute"?
I am using them in my application, in Ruby/Rails is a valid name.

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