Created
June 11, 2015 13:57
-
-
Save jessecurry/7e3a5ed08297d43741ac to your computer and use it in GitHub Desktop.
Example of GlobalID in a custom class
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 ReportBuilder | |
include GlobalID::Identification | |
def id | |
report.id | |
end | |
def self.find id | |
new(report_class.find(id)) | |
end | |
############################################################################# | |
def initialize report | |
@report = report | |
end | |
############################################################################# | |
protected | |
def self.report_class | |
Report | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment