Class: Phcscriptcdnpro::Scriptcdn::UrlsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phcscriptcdnpro::Scriptcdn::UrlsController
- Defined in:
- app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST Script URL.
-
#destroy ⇒ Object
Delete Script URL.
-
#edit ⇒ Object
Edit Script URL.
-
#index ⇒ Object
Index for Script URL.
-
#new ⇒ Object
New Script URL.
-
#update ⇒ Object
PATCH/PUT Script URL.
Methods inherited from ApplicationController
#current_user, #new_login_url, #require_user
Instance Method Details
#create ⇒ Object
POST Script URL
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb', line 34 def create @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = @scriptcdn_main.urls.create(scriptcdn_url_params) respond_to do |format| if @scriptcdn_url.save format.html { redirect_to scriptcdn_main_urls_path, notice: 'Script URL was Successfully Created.' } format.json { render action: 'show', status: :created, location: @scriptcdn_url } else format.html { render action: 'new' } format.json { render json: @scriptcdn_url.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
Delete Script URL
62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb', line 62 def destroy @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = @scriptcdn_main.urls.find(params[:id]) @scriptcdn_url.destroy respond_to do |format| format.html { redirect_to scriptcdn_main_urls_path, notice: 'Script URL was Successfully Deleted.' } format.json { head :no_content } end end |
#edit ⇒ Object
Edit Script URL
28 29 30 31 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb', line 28 def edit scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = scriptcdn_main.urls.find(params[:id]) end |
#index ⇒ Object
Index for Script URL
12 13 14 15 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb', line 12 def index scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_urls = scriptcdn_main.urls end |
#new ⇒ Object
New Script URL
18 19 20 21 22 23 24 25 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb', line 18 def new scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = scriptcdn_main.urls.build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @scriptcdn_main } end end |
#update ⇒ Object
PATCH/PUT Script URL
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb', line 49 def update respond_to do |format| if @scriptcdn_url.update(scriptcdn_url_params) format.html { redirect_to scriptcdn_main_urls_path, notice: 'Script URL was Successfully Updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @scriptcdn_url.errors, status: :unprocessable_entity } end end end |