CompetitorsController #index中的NameError

时间:2010-05-15 07:45:08

标签: ruby-on-rails ruby

我在服务器中运行此代码时遇到此问题。在我的 localhost 中,一切正常。但是当我在服务器部署我的代码时,它会向我显示错误。 我在模型中使用FERRET SERARCH。

CompetitorsController中的NameError #index

未初始化的常量竞争对手控制器::竞争对手

/opt/ruby_enterprise/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in`const_missing'

/ home / troche / mrecip_tool / releases / 20091219131859 / app / controllerscompetitors_controller .rb:19:in`index'

我的控制器

class CompetitorsController< ApplicationController中

包括AuthenticatedSystem   布局'应用'

auto_complete_for:被禁止的:竞争对手   auto_complete_for:fee_earner,:fee_earner

protect_from_forgery:only => [:标签]

before_filter:login_required,:only => [:index,:show,:new,:edit]

@@ total_company = 70

def index     @compet = Competitor.find(:all) ###在此行中获得错误

respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml => @compet }
end

def show     @competitor = Competitor.find(params [:id])

respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @competitor }
end


我的模型

类竞争者<的ActiveRecord ::基

validates_presence_of:fee_earner_id,:notes

belongs_to:fee_earner   belongs_to:country   belongs_to:state   belongs_to:user

acts_as_ferret:fields => [:competitor,:client,:subject_matter],:remote =>真

1 个答案:

答案 0 :(得分:0)

将错误行中的Competitor更改为::Competitor,以明确说明您想要的范围。