Created
May 28, 2012 15:58
-
-
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.
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 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 |
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
= render :partial 'shared/local', collection: @locals |
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
%pre | |
%code | |
= @local.try(:to_yaml) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment