Skip to content

Instantly share code, notes, and snippets.

View lucassimao's full-sized avatar
😎
coding for fun and profit

Lucas Simão lucassimao

😎
coding for fun and profit
View GitHub Profile
@lucassimao
lucassimao / gist:771932
Created January 9, 2011 19:31
Best way to add page specific javascript in a Rails 3 app
What I like to do is include the per-view Javascript in a content_for :head block and then yield to that block in your application layout. For example
If it's pretty short then:
<% content_for :head do %>
<script type="text/javascript">
$(function() {
$('user_rating_positve').click(function() {
$('some_div).show();
}