vol1ura/Sat_9am_5km

View on GitHub
app/views/pages/index.json.jbuilder

Summary

Maintainability
Test Coverage
sql = 'exists (select 1 from activities where activities.event_id = events.id and activities.published = true)'
json.events Event.in_country(top_level_domain).unscope(:order).where(sql) do |event|
  json.extract! event, :active, :town, :name, :place
  json.url event_url(event.code_name, format: :json)
end