Skip to content

Instantly share code, notes, and snippets.

@adamphillips
Created February 10, 2016 16:05
Show Gist options
  • Save adamphillips/853482a9d5d3bb68da1c to your computer and use it in GitHub Desktop.
Save adamphillips/853482a9d5d3bb68da1c to your computer and use it in GitHub Desktop.
class FairSummaryJson
def initialize(fair, options={})
@cash_report_url = options.fetch(:cash_report_url) { '' }
end
def to_hash
{
id: fair.id,
school: SchoolSummaryJson.new(fair.school).to_hash
cash_report_url: cash_report_url
}
end
end
def FairDetailJson
...
end
def SchoolSummaryJson
def initialize(school)
@school = school
end
def to_hash
{
id: school.id
name: school.name
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment