Class: Phcscriptcdnpro::Script::ListingsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phcscriptcdnpro::Script::ListingsController
- Defined in:
- app/controllers/phcscriptcdnpro/script/listings_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST - Script Listings.
-
#destroy ⇒ Object
DELETE - Script Listings.
-
#edit ⇒ Object
EDIT - Script Listings.
-
#index ⇒ Object
INDEX - Script Listings.
-
#new ⇒ Object
NEW - Script Listings.
-
#show ⇒ Object
DETAILS - Script Listings.
-
#update ⇒ Object
PATCH/PUT - Script Listings.
Methods inherited from ApplicationController
#authrocket_membership_info, #current_user, #new_login_url, #require_user, #user_for_paper_trail
Instance Method Details
#create ⇒ Object
POST - Script Listings
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 33 def create @script_listing = Script::Listing.new(script_listing_params) @script_listing.user_id = current_user.id @script_listing.user_name = current_user.username @script_listing.membership_id = authrocket_membership_info.id @script_listing.oganization_id = authrocket_membership_info.org_id if @script_listing.save redirect_to script_listings_path, notice: 'Listing was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE - Script Listings
60 61 62 63 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 60 def destroy @script_listing.destroy redirect_to script_listings_path, notice: 'Listing was successfully destroyed.' end |
#edit ⇒ Object
EDIT - Script Listings
29 30 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 29 def edit end |
#index ⇒ Object
INDEX - Script Listings
13 14 15 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 13 def index @script_listings = Script::Listing.where(oganization_id: authrocket_membership_info.org_id) end |
#new ⇒ Object
NEW - Script Listings
24 25 26 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 24 def new @script_listing = Script::Listing.new end |
#show ⇒ Object
DETAILS - Script Listings
18 19 20 21 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 18 def show @script_listings = Script::Listing.friendly.find(params[:id]) @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category') end |
#update ⇒ Object
PATCH/PUT - Script Listings
47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/phcscriptcdnpro/script/listings_controller.rb', line 47 def update @script_listing.user_id = current_user.id @script_listing.user_name = current_user.username @script_listing.membership_id = authrocket_membership_info.id @script_listing.oganization_id = authrocket_membership_info.org_id if @script_listing.update(script_listing_params) redirect_to script_listings_path, notice: 'Listing was successfully updated.' else render :edit end end |