Created
July 17, 2010 13:45
-
-
Save franciscoj/479514 to your computer and use it in GitHub Desktop.
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
<!-- app/views/foos/_foo.html.erb --> | |
<tr> | |
<td> | |
<%= foo.name %> | |
</td> | |
<td> | |
<%= foo.color %> | |
</td> | |
</tr> |
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
<!-- app/views/foos/_foos.html.erb --> | |
<table> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Color</th> | |
</tr> | |
</thead> | |
<tbody> | |
<%= render @foos %> | |
</tbody> | |
</table> |
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
<!-- app/views/foos/_foos_empty.html.erb --> | |
<p>No foos yet... <%= link_to "create some!", new_foo_path %></p> |
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
# app/helpers/foos_helper.rb | |
module FoosHelper | |
def render_foos | |
if @foos.blank? | |
render :partial => "foos_empty" | |
else | |
render :partial => "foos" | |
end | |
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
<!-- app/views/foos/index.html.erb --> | |
<%= render_foos %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment