Created
May 17, 2011 18:33
-
-
Save nurey/977064 to your computer and use it in GitHub Desktop.
This file contains 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
class ScheduleGroup < ActiveRecord::Base | |
include AbstractGroup | |
has_and_belongs_to_many :schedules | |
end | |
class Schedule < ActiveRecord::Base | |
has_and_belongs_to_many :schedule_groups | |
end | |
module AbstractGroup | |
before_destroy :removable? | |
def removable? | |
self.schedules.empty? # self.collection.empty? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry, make that
groupings.concat(associations)
.