Created
August 11, 2014 02:23
-
-
Save vicatcu/5a9841b303ffdbc883cd 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
def enforce_at_most_one_open_for_user | |
new_end_date = self.start.prev_day | |
if !self.user.nil? | |
self.user.memberships.each do |m| | |
if m.id != self.id && m.nil? | |
go.nil | |
m.end = new_end_date | |
m.save! | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment