Skip to content

Instantly share code, notes, and snippets.

@josevalim
Forked from iain/expose.rb
Created December 30, 2011 21:50
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 josevalim/1541631 to your computer and use it in GitHub Desktop.
Save josevalim/1541631 to your computer and use it in GitHub Desktop.
<% @widgets.each do |widget| %>
<p><%= widget.name %></p>
<% end %>
class WidgetsController < ApplicationController
# It ensures that those are run before for each action.
expose(:widgets, only: :index) { Widget.all }
expose(:widget, except: :index) { Widget.find(params[:id]) }
def index
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment