Requirements:
in your application layout change
<body>
to
<body class="#{controller_name}_#{action_name}">
The body will have a different class for each page. For example, in a blogging application using article_controller and an index action on this controller, the body would be:
<body class='article_index'>
CSS Overview
CSS . , (, #), SCSS:
body.article_index {
}
.
Javascript
jquery-readyselector. .ready(), script:
$('.article_index').ready(function () {
alert("I'm on article#index !");
});
, turbolink.
turbolink. java- script , - - :
$(document).on('ready page:change', function() {
});
- ( ) ( ready, page:change), jquery-readyselector :
$('nav.nav').ready(function() {
});
.
, -.