Skip to content

Instantly share code, notes, and snippets.

@cherring
Last active September 25, 2017 05:58
Show Gist options
  • Save cherring/9a27643946b6d31d1624567577fdacc6 to your computer and use it in GitHub Desktop.
Save cherring/9a27643946b6d31d1624567577fdacc6 to your computer and use it in GitHub Desktop.
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
@cherring
Copy link
Author

Ah ok. I am a bit relieved that I was not missing something super obvious, thanks @timriley :)

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