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

Use before validate instead of before create #25

Merged

Conversation

webervin
Copy link

In addition to having not null for column in database we could have rails validation for presence of column. However if position is assigned after validation, then validation would not pass and record would not be saved.

Changed both code and spec, however additional changes may be required for older versions of rails, I am not sure about callback syntax for old rails versions, probably will need any conditional there.

swanandp added a commit that referenced this pull request Nov 24, 2011
…efore_create

Use before validate instead of before create
@swanandp swanandp merged commit 59af94b into brendon:master Nov 24, 2011
@swanandp
Copy link
Contributor

Pulled! Thanks for contributing!

@joshuapinter
Copy link
Contributor

For those landing here, in the latest version the position column is set after validation so you shouldn't use a validates presence on position, as per the latest README:

The position column is set after validations are called, so you should not put a presence validation on the position column.

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

Successfully merging this pull request may close these issues.

3 participants