Created
October 11, 2017 10:10
-
-
Save pieterjongsma/2c99ffda544fde2635c53f082e62083c to your computer and use it in GitHub Desktop.
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 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