Skip to content

Instantly share code, notes, and snippets.

@pieterjongsma
Created October 11, 2017 10:10
Show Gist options
  • Save pieterjongsma/2c99ffda544fde2635c53f082e62083c to your computer and use it in GitHub Desktop.
Save pieterjongsma/2c99ffda544fde2635c53f082e62083c to your computer and use it in GitHub Desktop.
class EventsFeed
include Enumerable
delegate :each, :<<, to: :events
def initialize(events:, user:)
@events = events
@user = user
end
def events
@events
end
end
class EventsController < ApplicationController
def index
@events = EventsFeed.new(events: Event.all, user: current_user)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment