Skip to content

Instantly share code, notes, and snippets.

View iwasrobbed's full-sized avatar
:shipit:
"1 billion years".Save()

rob phillips iwasrobbed

:shipit:
"1 billion years".Save()
View GitHub Profile
<table>
<%= render :partial => 'foo_row', :collection => @foobars %>
</table>
# _foo_row.html.erb
<tr>
<td>
<%= foobar.name %>
</td>
# app/views/layout/application.rb
<html>
<head>
<%= yield :head %>
...
# app/views/foobars/index.html.erb
<% content_for :head do %>
<script type='text/javascript'>
def link_to_with_highlight(name, options = {}, html_options = {}) # same sig as #link_to
html_options.merge!({ :class => 'active' }) if current_page?(options)
link_to(name, options, html_options)
end