Class: Phcscriptcdnpro::Script::UrlsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phcscriptcdnpro::Script::UrlsController
- Includes:
- Phccorehelpers::PhcpluginsproHelper
- Defined in:
- app/controllers/phcscriptcdnpro/script/urls_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
CREATE.
-
#destroy ⇒ Object
DELETE.
-
#edit ⇒ Object
EDIT.
-
#index ⇒ Object
INDEX.
-
#new ⇒ Object
NEW.
-
#show ⇒ Object
SHOW.
-
#update ⇒ Object
UPDATE.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
CREATE
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 37 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, :flash => { :success => 'Author was successfully created.' } else render :new end end |
#destroy ⇒ Object
DELETE
59 60 61 62 63 64 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 59 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, :flash => { :error => 'Author was successfully destroyed.' } end |
#edit ⇒ Object
EDIT
31 32 33 34 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 31 def edit script_listing = Script::Listing.find(params[:listing_id]) @script_url = script_listing.urls.find(params[:id]) end |
#index ⇒ Object
INDEX
13 14 15 16 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 13 def index script_listing = Script::Listing.find(params[:listing_id]) @script_urls = script_listing.urls.where(org_id: current_user.org_id) end |
#new ⇒ Object
NEW
25 26 27 28 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 25 def new script_listing = Script::Listing.find(params[:listing_id]) @script_url = script_listing.urls.build end |
#show ⇒ Object
SHOW
19 20 21 22 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 19 def show script_listing = Script::Listing.find(params[:listing_id]) @script_url = script_listing.urls.friendly.find(params[:id]) end |
#update ⇒ Object
UPDATE
50 51 52 53 54 55 56 |
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 50 def update if @script_url.update(script_url_params) redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully updated.' } else render :edit end end |