Class: Phcscriptcdnpro::Script::UrlsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phcscriptcdnpro::Script::UrlsController
- Defined in:
- app/controllers/phcscriptcdnpro/script/urls_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST - Script Athors.
-
#destroy ⇒ Object
DELETE - Script Athors.
-
#edit ⇒ Object
EDIT - Script Athors.
-
#index ⇒ Object
INDEX - Script Authors.
-
#new ⇒ Object
NEW - Script Athors.
-
#show ⇒ Object
DETAILED PROFILE - Script Authors.
-
#update ⇒ Object
PATCH/PUT - Script Athors.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST - Script Athors
38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 38 def create @script_listing = Script::Listing.find(params[:listing_id]) @script_url = @script_listing.urls.create(script_url_params) @script_url.user_id = current_user.id @script_url.org_id = current_user.org_id if @script_url.save redirect_to script_listing_urls_path, notice: 'Author was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE - Script Athors
62 63 64 65 66 67 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 62 def destroy @script_listing = Script::Listing.find(params[:listing_id]) @script_url = @script_listing.urls.find(params[:id]) @script_url.destroy redirect_to script_listing_urls_path, notice: 'Author was successfully destroyed.' end |
#edit ⇒ Object
EDIT - Script Athors
32 33 34 35 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 32 def edit script_listing = Script::Listing.find(params[:listing_id]) @script_url = script_listing.urls.find(params[:id]) end |
#index ⇒ Object
INDEX - Script Authors
12 13 14 15 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 12 def index script_listing = Script::Listing.find(params[:listing_id]) @script_urls = script_listing.urls end |
#new ⇒ Object
NEW - Script Athors
24 25 26 27 28 29 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 24 def new script_listing = Script::Listing.find(params[:listing_id]) @script_url = script_listing.urls.build @script_url.user_id = current_user.id @script_url.org_id = current_user.org_id end |
#show ⇒ Object
DETAILED PROFILE - Script Authors
18 19 20 21 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 18 def show script_listing = Script::Listing.find(params[:listing_id]) @script_url = script_listing.urls.friendly.find(params[:id]) end |
#update ⇒ Object
PATCH/PUT - Script Athors
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 51 def update @script_url.user_id = current_user.id @script_url.org_id = current_user.org_id if @script_url.update(script_url_params) redirect_to script_listing_urls_path, notice: 'Author was successfully updated.' else render :edit end end |