I set a cookie but otherwise don’t really have any variables that
cross. I also have other forms that are even simpler (not even the
cookie) and they blank out as well. I also checked my views, no
variables are the same. Thanks for your help.
class Qcsubmissions::SetupDatabasesController < ApplicationController
layout ‘qcsubmissions’
def create
if params[:setup_database][‘page’] == “index”
#Set variables and set cookies
sCode = params[:setup_database][‘DatabaseCode’]
cookies[:code] = sCode
#determine if code is queriable or not
db = SetupDatabase.new(sCode, current_user.name)
bExist = db.newDatabase()
if bExist then
redirect_to :action => :query
else
redirect_to :action => :add
end
#Add new, Product and Action Tables
elsif params[:setup_database][‘page’] == “add”
#Set variables and set cookies
sCode = params[:setup_database][‘DatabaseCode’]
cookies[:code] = sCode
#determine if code is queriable or not
db = SetupDatabase.new(sCode, current_user.name)
bExist = db.newDatabase()
if bExist == false
if validateProductTable(params[:setup_database],
params[:dbType], params[:interface])
db.addProduct(params[:setup_database][‘DatabaseName’],
params[:dbType], params[:interface])
redirect_to :action => :query
db.emailSD(current_user.id)
else
render :action => :add
end
else
render :action => :add
end
else
render :action => :add
end
else
flash[:error] = “
Submission Not Accepted: Database
already exists.
”
redirect_to :action => :query
end
end
end
def query
#variables to pass to the view
@code = cookies[:code]
@db = “development”
end
def add
#variables to pass to the view
@code = cookies[:code]
end
def index
end
def show
redirect_to :action => :index
end
#Validate Insert into Product Table
def validateProductTable(formParams, formType, interface)
bOK = true
fmessage = Array.new
if formParams[‘DatabaseName’].blank?
bOK = false
fmessage << “
Database Name is required.
”
end
if formParams[‘DatabaseCode’].blank?
bOK = false
fmessage << “
Database Name is required.
”
end
if formType.blank?
bOK = false
fmessage << “
Database Type must be selected.
”
end
if interface.blank?
bOK = false
fmessage << “
Interface must be selected.
”
end
if fmessage.length > 0
flash[:error] = fmessage
end
return bOK
end
end