Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for defaultMessageCode give incorrect message code name #21

Open
jonroler opened this issue Mar 30, 2013 · 0 comments
Open

Docs for defaultMessageCode give incorrect message code name #21

jonroler opened this issue Mar 30, 2013 · 0 comments

Comments

@jonroler
Copy link

The docs here:

https://github.com/geofflane/grails-constraints/blob/master/README.markdown#defaultmessagecode-property-optional

state that "The default value is default.$name.invalid.message". However, it appears that the actual default value of the defaultMessageCode is default.invalid.$name.message ($name and invalid are in different orders). However, I don't think the fix should be to change the docs. To be consistent with the rest of grails (look at the default messages for the built-in grails constraints as well as the message codes defined for custom constraints by this plugin), I believe the code should be fixed to reflect what the docs say. It looks like the DefaultGrailsConstraintClass is the problem:

public String getDefaultMessageCode() {
    String obj = (String)getPropertyValue(DEFAULT_MESSAGE_CODE_PROPERTY);
    if (obj == null) return "default.invalid." + getConstraintName() + ".message";
    return obj;
}

This line:

if (obj == null) return "default.invalid." + getConstraintName() + ".message";

should change to read:

if (obj == null) return "default."  + getConstraintName() + ".invalid.message";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant