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 = Lines::Author.new() if @author.save redirect_to @author 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 = Lines::Author.find(params[:id]) if @author.destroy redirect_to else @authors = Lines::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 = Lines::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 @authors = Lines::Author.all end |
#new ⇒ Object
New author
20 21 22 |
# File 'app/controllers/lines/admin/authors_controller.rb', line 20 def new @author = Lines::Author.new end |