Created
January 31, 2013 20:44
-
-
Save mrpunkin/4686269 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
| class Challenge < ActiveRecord::Base | |
| has_many :challenge_photos, :dependent=>:destroy | |
| has_many :photos, :through=>:challenge_photo | |
| end |
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
| class ChallengePhoto < ActiveRecord::Base | |
| belongs_to :challenge | |
| belongs_to :photo | |
| before_destroy :optout | |
| def optout | |
| Rails.console.log("Opting out") | |
| end | |
| end |
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
| class Photo < ActiveRecord::Base | |
| has_many :challenge_photos, :dependent=>:destroy | |
| has_many :challenges, :through=>:challenge_photos | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment