Sha256: afaca5f7e501e46076d5ed4f4475f163f85dc7a7465560bbfdf8609c1f8636dc

Contents?: true

Size: 511 Bytes

Versions: 11

Compression:

Stored size: 511 Bytes

Contents

class BooksController < ApplicationController
  before_action :set_author
  before_action :set_book, only: :show

  # GET /authors/author-slug/books
  def index
    @books = @author.books
  end

  # GET /authors/author-slug/books/book-slug
  def show
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_book
      @book = @author.books.friendly.find(params[:id])
    end

    def set_author
      @author = Author.friendly.find(params[:author_id])
    end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
friendly_id-method_scopes-0.3.7 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.3.3 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.3.2 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.3.1 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.3.0 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.2.6 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.2.5 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.1.8 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.1.7 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.1.6 spec/dummy/app/controllers/books_controller.rb
friendly_id-method_scopes-0.1.5 spec/dummy/app/controllers/books_controller.rb