https://github.com/salzig/has_many_through_validation
https://github.com/salzig/has_many_through_validation
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/salzig/has_many_through_validation
- Owner: salzig
- Created: 2012-02-16T23:21:54.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-02-17T00:00:36.000Z (over 14 years ago)
- Last Synced: 2025-03-26T00:36:49.926Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Purpose
A friend told me that he has some problems validating attributes using a conditional based on referenced resource. This is an small "copy" of his setup for testing purpose.
#Setup
git clone
rake db:setup
#Testing
User.first.valid?
# true
User.new(:roles => [Role.first]).valid?
# false
User.new(:roles => [Role.first], :name => "test").valid?
# true
#Related Links
* http://www.agilereasoning.com/2008/04/26/using-belongs_to-in-rails-model-validations-when-the-parent-is-unsaved/