Class: Phcscriptcdnpro::Scriptcdn::AuthorsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phcscriptcdnpro::Scriptcdn::AuthorsController
- Defined in:
- app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST Author.
-
#destroy ⇒ Object
DELETE Author.
-
#edit ⇒ Object
Edit Author.
-
#index ⇒ Object
Author Index.
-
#new ⇒ Object
New Author.
-
#update ⇒ Object
PATCH/PUT Author.
Methods inherited from ApplicationController
#current_user, #new_login_url, #require_user
Instance Method Details
#create ⇒ Object
POST Author
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb', line 30 def create @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_author = @scriptcdn_main..create() if @scriptcdn_author.save redirect_to , notice: 'Author was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE Author
50 51 52 53 54 55 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb', line 50 def destroy @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_author = @scriptcdn_main..find(params[:id]) @scriptcdn_author.destroy redirect_to , notice: 'Author was successfully destroyed.' end |
#edit ⇒ Object
Edit Author
24 25 26 27 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb', line 24 def edit scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_author = scriptcdn_main..find(params[:id]) end |
#index ⇒ Object
Author Index
12 13 14 15 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb', line 12 def index scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_authors = scriptcdn_main. end |
#new ⇒ Object
New Author
18 19 20 21 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb', line 18 def new scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_author = scriptcdn_main..build end |
#update ⇒ Object
PATCH/PUT Author
41 42 43 44 45 46 47 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb', line 41 def update if @scriptcdn_author.update() redirect_to , notice: 'Author was successfully updated.' else render :edit end end |