class UrlsController < ApplicationController before_filter :signed_in_user, only: [:create] def create @urls = Url.new(params[:url][:trig_type]) unless @urls.nil? button = params[:url][:button_type] address = params[:url][:address] if ('add' == button && (address.empty?)) flash[:error] = "Cannot add empty address." elsif ('add' == button && (address.match(/\s/))) flash[:error] = "Address cannot contain white space." elsif ('add' == button && !(address.empty?)) @urls << (address) elsif ('delete' == button) @urls.delete(address) end Utils::send_webhook_urls(params[:url][:trig_type], @urls.uniq) end redirect_to webhooks_url end end