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

Already on GitHub? Sign in to your account

AM::Validation#validates: custom exception for :strict option #7024

Merged
merged 1 commit into from Aug 16, 2012

Conversation

Projects
None yet
7 participants
Contributor

bogdan commented Jul 10, 2012

Ability to pass custom exception to :strict option of validates
Example:

validates :token, :presence => true, :uniqueness => true, 
  :strict => TokenGenerationError

Looks ok to me, but would need a changelog entry + an update on the validations guide, I think there's a "strict" section there. Thanks!

@troessner troessner and 2 others commented on an outdated diff Jul 10, 2012

activemodel/test/cases/validations_test.rb
@@ -323,6 +323,14 @@ def test_strict_validation_in_custom_validator_helper
end
end
+ class CustomStrictValidationException < StandardError; end
@troessner

troessner Jul 10, 2012

I think a newline here would increase readability, on first glance I thought you had messed up the indentation.

@dmathieu

dmathieu Jul 10, 2012

Contributor

Actually, it'd probably even be more readable to move the class definition to the top of the file, outside of the ValidationsTest class.

@bogdan

bogdan Jul 11, 2012

Contributor

Moved to to and inside ValidationsTest. Making it inside looks a better idea to not make global namespace dirby and this is way it is done in other tests.

Contributor

bogdan commented Jul 11, 2012

Added changelog entry, added to guides, fixed white space.

Member

steveklabnik commented Aug 4, 2012

This will need a rebase.

Contributor

bogdan commented Aug 6, 2012

rebased

Member

schneems commented Aug 16, 2012

Ping, last comment 10 days ago. OP followed all instructions from rails core, 👍 on change, is there anything preventing this merged in?

Owner

rafaelfranca commented Aug 16, 2012

@schneems I'll merge this now. Thank you to remember. You are doing a great job ❤️

rafaelfranca added a commit that referenced this pull request Aug 16, 2012

Merge pull request #7024 from bogdan/strict_validation_custom_exception
AM::Validation#validates: custom exception for :strict option

Conflicts:
	activemodel/CHANGELOG.md

@rafaelfranca rafaelfranca merged commit 2e4f798 into rails:master Aug 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment