Class: Lines::Admin::AuthorsController
- Inherits:
-
Lines::ApplicationController
- Object
- ActionController::Base
- Lines::ApplicationController
- Lines::Admin::AuthorsController
- Defined in:
- app/controllers/lines/admin/authors_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Create a new author from params.
-
#destroy ⇒ Object
Delete an author.
-
#edit ⇒ Object
Edit an existing author.
-
#index ⇒ Object
Listes all authroes.
-
#new ⇒ Object
New author.
-
#show ⇒ Object
Shows an author.
-
#update ⇒ Object
Update an existing author from params.
Instance Method Details
#create ⇒ Object
Create a new author from params
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 30 def create = Author.new() if .save redirect_to , notice: 'Author was successfully created.' else render action: "new" end end |
#destroy ⇒ Object
Delete an author
52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 52 def destroy = Author.find(params[:id]) if .destroy redirect_to else = Author.all render "index" end end |
#edit ⇒ Object
Edit an existing author
25 26 27 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 25 def edit = Author.find(params[:id]) end |
#index ⇒ Object
Listes all authroes
10 11 12 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 10 def index = Author.all end |
#new ⇒ Object
New author
20 21 22 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 20 def new = Lines::Author.new end |
#show ⇒ Object
Shows an author
15 16 17 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 15 def show = Author.find(params[:id]) end |
#update ⇒ Object
Update an existing author from params
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 41 def update = Author.find(params[:id]) if .update_attributes() redirect_to , notice: 'Author was successfully updated.' else render action: "edit" end end |