Skip to content

Instantly share code, notes, and snippets.

@mathias
Created May 28, 2012 15:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathias/2819837 to your computer and use it in GitHub Desktop.
Save mathias/2819837 to your computer and use it in GitHub Desktop.
An idea for printing out available local variables and their attributes in a Rails view.
class FooController < ApplicationController
def index
@foo = Foo.find(params[:id])
@bar = Bar.find(params[:bar_id])
@locals = @foo + @bar # this line and the locals view stuff gets removed when you're done developing
end
end
= render :partial 'shared/local', collection: @locals
%pre
%code
= @local.try(:to_yaml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment