Skip to content

Instantly share code, notes, and snippets.

@RyanCCollins
Created October 11, 2016 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanCCollins/1a34f7081ecc81210f2c848eb6044a66 to your computer and use it in GitHub Desktop.
Save RyanCCollins/1a34f7081ecc81210f2c848eb6044a66 to your computer and use it in GitHub Desktop.
field :events, types[EventType] do
argument :first, types.Int
resolve -> (obj, args, ctx) {
events = Event.all.sort_by(&:start_date).reverse
if args[:first]
events = events.first(args[:first])
end
events
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment