Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## body_helper.rb
- module BodyHelper
- def body_class(body_class)
- @body_class ||= ""
- @body_class << "#{body_class}"
- end
- end
- ## application_controller.rb
- class ApplicationController < ActionController::Base
- protect_from_forgery
- helper :all
- before_filter :setup_menu
- def setup_menu
- #look into building a hash
- #@nav_data[:authors] = Author.all
- @all_authors = Author.order(:name)
- @genres = Genre.all
- end
- end
- ##books_controller.rb
- def index
- @books = Book.order(:title)
- body_class "books"
- end
Add Comment
Please, Sign In to add comment