Skip to content

Instantly share code, notes, and snippets.

@tbuehlmann
Forked from bsylvain/model.rb
Created October 13, 2016 12:11
Show Gist options
  • Save tbuehlmann/3fb5c5682269454432498a8bde8768c6 to your computer and use it in GitHub Desktop.
Save tbuehlmann/3fb5c5682269454432498a8bde8768c6 to your computer and use it in GitHub Desktop.
can it be reduced to a one liner ?
validate :relation_with_same_tenant
.......
private
def relation_with_same_tenant
if self.shop_id!=ui_listable.shop_id
self.errors.add(:ui_listable,"ERROR MESSAGE")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment