Created
December 13, 2021 11:42
-
-
Save wdspkr/2d1eb793307259f88fa69f0d29e5f559 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
module InterestRepository | |
def my_index | |
InterestCollection.new(InterestRecord.includes(:account).order(percentage: :desc).all) | |
end | |
end | |
class InterestCollection < Array | |
def initialize(record_array) | |
inital_array = record_array.map do |interest_data| | |
Interest.new(interest_data.attributes_with_associations) | |
end | |
super(initial_array) | |
end | |
def my_custom_collection_method | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment