Created
September 12, 2011 15:49
-
-
Save svesely/1211602 to your computer and use it in GitHub Desktop.
Collection operations?
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
# My understanding of classical OOP would suggest that this model is a better model of the business practice: | |
class Payment | |
def process | |
### | |
end | |
end | |
Class PaymentCollection | |
has_many :payments | |
def process_all_payments | |
### | |
end | |
end | |
# However, with many Ruby (read: "Rails") apps, we're encouraged to tie the "multiple instances" operations into the class itself: | |
class Payment | |
def self.process_all_payments(ids = []) | |
### | |
end | |
def process | |
end | |
end | |
end | |
# How does this coincide with the concept of "classical OOP"? | |
Nope- I was conflating the two concepts. Updated.
Thanks for the clarification!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On line #12, did you mean for that to be a singleton method?