Class: Phcscriptcdnpro::Scriptcdn::UrlsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #new_login_url, #require_user

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

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

#indexObject

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

#newObject

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

#updateObject

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