app/controllers/phcscriptcdnpro/script/urls_controller.rb in phcscriptcdnpro-28.0.0 vs app/controllers/phcscriptcdnpro/script/urls_controller.rb in phcscriptcdnpro-29.0.0
- old
+ new
@@ -2,12 +2,11 @@
module Phcscriptcdnpro
class Script::UrlsController < ApplicationController
# Security & Action Filters
- before_action :require_user
- before_action :authrocket_membership_info
+ before_action :authenticate_user!
before_action :set_paper_trail_whodunnit
before_action :set_script_url, only: [:show, :edit, :update, :destroy]
# INDEX - Script Authors
def index
@@ -23,10 +22,12 @@
# NEW - Script Athors
def new
script_listing = Script::Listing.find(params[:listing_id])
@script_url = script_listing.urls.build
+ @script_url.user_id = current_user.id
+ @script_url.org_id = current_user.org_id
end
# EDIT - Script Athors
def edit
script_listing = Script::Listing.find(params[:listing_id])
@@ -36,25 +37,21 @@
# POST - Script Athors
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.user_name = current_user.username
- @script_url.membership_id = authrocket_membership_info.id
- @script_url.oganization_id = authrocket_membership_info.org_id
+ @script_url.org_id = current_user.org_id
if @script_url.save
redirect_to script_listing_urls_path, notice: 'Author was successfully created.'
else
render :new
end
end
# PATCH/PUT - Script Athors
def update
@script_url.user_id = current_user.id
- @script_url.user_name = current_user.username
- @script_url.membership_id = authrocket_membership_info.id
- @script_url.oganization_id = authrocket_membership_info.org_id
+ @script_url.org_id = current_user.org_id
if @script_url.update(script_url_params)
redirect_to script_listing_urls_path, notice: 'Author was successfully updated.'
else
render :edit
end