Class: Phcscriptcdnpro::Script::UrlsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #get_member_profile_info, #membership_info, #new_login_url, #phcpress_recent_posts, #require_user

Instance Method Details

#createObject

POST - Script Athors



35
36
37
38
39
40
41
42
43
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 35

def create
	@script_listing = Script::Listing.find(params[:listing_id])
	@script_url = @script_listing.urls.create(script_url_params)
	if @script_url.save
		redirect_to script_listing_urls_path, notice: 'Author was successfully created.'
		else
			render :new
	end
end

#destroyObject

DELETE - Script Athors



55
56
57
58
59
60
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 55

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

#editObject

EDIT - Script Athors



29
30
31
32
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 29

def edit
	script_listing = Script::Listing.find(params[:listing_id])
	@script_url = script_listing.urls.find(params[:id])
end

#indexObject

INDEX - Script Authors



11
12
13
14
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 11

def index
	script_listing = Script::Listing.find(params[:listing_id])
	@script_urls = script_listing.urls
end

#newObject

NEW - Script Athors



23
24
25
26
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 23

def new
	script_listing = Script::Listing.find(params[:listing_id])
	@script_url = script_listing.urls.build
end

#showObject

DETAILED PROFILE - Script Authors



17
18
19
20
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 17

def show
	script_listing = Script::Listing.find(params[:listing_id])
	@script_url = script_listing.urls.find(params[:id])
end

#updateObject

PATCH/PUT - Script Athors



46
47
48
49
50
51
52
# File 'app/controllers/phcscriptcdnpro/script/urls_controller.rb', line 46

def update
	if @script_url.update(script_url_params)
		redirect_to script_listing_urls_path, notice: 'Author was successfully updated.'
		else
			render :edit
	end
end