Class: AuthorsController

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

Instance Method Summary collapse

Instance Method Details

#createObject


29
30
31
32
33
34
35
# File 'app/controllers/authors_controller.rb', line 29

def create
  @author = Author.new(author_params)
  authorize @author
  @author.save

  respond_with(@author)
end

#destroyObject


43
44
45
46
47
# File 'app/controllers/authors_controller.rb', line 43

def destroy
  @author.destroy

  respond_with(@author)
end

#editObject


26
27
# File 'app/controllers/authors_controller.rb', line 26

def edit
end

#indexObject


6
7
8
9
# File 'app/controllers/authors_controller.rb', line 6

def index
  @authors = policy_scope(Author).page(params[:page])
  respond_with(@authors)
end

#newObject


19
20
21
22
23
24
# File 'app/controllers/authors_controller.rb', line 19

def new
  @author = Author.new
  authorize @author

  respond_with(@author)
end

#showObject


11
12
13
14
15
16
17
# File 'app/controllers/authors_controller.rb', line 11

def show
  @awardable = @author
  @awards = @awardable.awards
  @award = Award.new

  respond_with(@author)
end

#updateObject


37
38
39
40
41
# File 'app/controllers/authors_controller.rb', line 37

def update
  @author.update(author_params)
  
  respond_with(@author)
end