Created
June 18, 2013 12:07
-
-
Save wearethefoos/5804813 to your computer and use it in GitHub Desktop.
Render templates without double render errors
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 in before_filter | |
before_filter | |
render 'template' and return | |
end | |
# Render conditional | |
def index | |
respond_to do |format| | |
if a | |
format.html { render 'a' } | |
elsif b | |
format.html { render 'b' } | |
else | |
format.html # index.html.haml | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment