Skip to content

Instantly share code, notes, and snippets.

@bricker
Created December 16, 2013 19:15
Show Gist options
  • Select an option

  • Save bricker/7992641 to your computer and use it in GitHub Desktop.

Select an option

Save bricker/7992641 to your computer and use it in GitHub Desktop.
def slides_exists_and_are_hashed_yaml
return if slides.blank?
slides_yml = YAML.load(slides)
if Array(slides_yml).any? { |_, v| v.nil? } || slides_yml.instance_of?(String)
errors.add(:slides, 'not a valid YAML file (did you include at least one key: value?)')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment