Class: BooksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/books_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


26
27
28
29
30
31
32
# File 'app/controllers/books_controller.rb', line 26

def create
  @book = Book.new(book_params)
  authorize @book
  @book.save

  respond_with(@book)
end

#destroyObject


40
41
42
43
44
# File 'app/controllers/books_controller.rb', line 40

def destroy    
  @book.destroy

  respond_with(@book)
end

#editObject


23
24
# File 'app/controllers/books_controller.rb', line 23

def edit    
end

#indexObject


7
8
9
10
# File 'app/controllers/books_controller.rb', line 7

def index
  @books = policy_scope(Book).page(params[:page])
  respond_with(@books)
end

#newObject


16
17
18
19
20
21
# File 'app/controllers/books_controller.rb', line 16

def new
  @book = Book.new
  authorize @book

  respond_with(@book)
end

#showObject


12
13
14
# File 'app/controllers/books_controller.rb', line 12

def show
  respond_with(@book)
end

#updateObject


34
35
36
37
38
# File 'app/controllers/books_controller.rb', line 34

def update    
  @book.update(book_params)

  respond_with(@book)
end