an uninitialized constant ApplicationController (Name Error)
Any idea what can be causing this? I have application.rb. Here is my
amin.controller.rb that is causing the error.
class AdminController < ApplicationController
before_filter :authorize
def index
list
render :action => ‘list’
end
GETs should be safe (see
URIs, Addressability, and the use of HTTP GET and POST)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@account_pages, @accounts = paginate :accounts, :per_page => 10
end
def show
@account = Account.find(params[:id])
end
def new
@account = Account.new
end
def create
# account_number = 2 test account_number to make sure it wasn’t null
@account = Account.new(@params[:account])
if @account.save
flash[‘notice’] = ‘Account was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
def edit
@account = Account.find(params[:id])
end
def update
@account = Account.find(params[:id])
if @account.update_attributes(params[:account])
flash[:notice] = ‘Account was successfully updated.’
redirect_to :action => ‘show’, :id => @account
else
render :action => ‘edit’
end
end
def destroy
Account.find(params[:id]).destroy
redirect_to :action => ‘list’
end
end
I am also getting an error when the ‘create’ method is called.
ActiveRecord::StatementInvalid (Mysql::Error: #23000Column
‘account_number’ cannot be null: INSERT INTO accounts (city
, name
,
zip
, hashed_password
, contact_phone
, technician
,
contact_email
, executive
, account_number
, address
,
contact_name
, state
) VALUES(NULL, NULL, NULL,
‘11ab3a5d9ae5e9b03b532c949a2508139a4c1652’, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL))
It looks to me like the only thing that it is accepting is the
hashed_password field. I’ve put values into all of the fields. When I
click create this is what I get.