Created
May 22, 2012 21:08
-
-
Save ivanacostarubio/2771631 to your computer and use it in GitHub Desktop.
A sample of the Open Close Principle
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
| # THIS | |
| def classrooms_in_same_building | |
| return [] unless building | |
| Classroom.where(:building_id => building.id) | |
| end | |
| # | |
| # THIS VS THAT! | |
| # | |
| # THAT | |
| def classrooms_in_same_building(classroom=Classroom) | |
| return [] unless building | |
| classroom.where(:building_id => building.id) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment