Skip to content

Instantly share code, notes, and snippets.

@sighmin
Created September 29, 2015 19:50
Show Gist options
  • Save sighmin/9071c70e9db7f58c153c to your computer and use it in GitHub Desktop.
Save sighmin/9071c70e9db7f58c153c to your computer and use it in GitHub Desktop.
class DashboardView
def initialize(current_user, users, featured_posts)
@current_user = current_user
@users = users.map { |u| UserView.new(u) }
@featured_posts = featured_posts
end
attr_reader :current_user, :users, :featured_posts
end
# Instantiate this in your controller layer and pass it to the view as the only "source of truth" for the data on the page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment