Last active
September 25, 2017 05:58
-
-
Save cherring/9a27643946b6d31d1624567577fdacc6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ProfileValidator | |
def self.validate(profile, scentregroup_id) | |
profile_schema.call(profile.merge(scentregroup_id: scentregroup_id)) | |
end | |
def self.profile_schema | |
required(:centre).filled | |
required(:number_plates).each do | |
schema do | |
required(:plate).filled | |
required(:registered_in).filled | |
validate(plate_available: %i[plate]) do |plate| | |
### How can I use the centre attribute in here? | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah ok. I am a bit relieved that I was not missing something super obvious, thanks @timriley :)