0

When starting my rails application I get the following error. Can someone give me a hint where to search for an error?

undefined method `table_alias' for #<ActiveRecord::Relation:0x0000000339df20>

This is my gemfile.lock

GEM
  remote: http://rubygems.org/
  specs:
    abstract (1.0.0)
    actionmailer (3.0.12)
      actionpack (= 3.0.12)
      mail (~> 2.2.19)
    actionpack (3.0.12)
      activemodel (= 3.0.12)
      activesupport (= 3.0.12)
      builder (~> 2.1.2)
      erubis (~> 2.6.6)
      i18n (~> 0.5.0)
      rack (~> 1.2.5)
      rack-mount (~> 0.6.14)
      rack-test (~> 0.5.7)
      tzinfo (~> 0.3.23)
    activemodel (3.0.12)
      activesupport (= 3.0.12)
      builder (~> 2.1.2)
      i18n (~> 0.5.0)
    activerecord (3.0.12)
      activemodel (= 3.0.12)
      activesupport (= 3.0.12)
      arel (~> 2.0.10)
      tzinfo (~> 0.3.23)
    activerecord-mysql2-adapter (0.0.3)
      mysql2
    activeresource (3.0.12)
      activemodel (= 3.0.12)
      activesupport (= 3.0.12)
    activesupport (3.0.12)
    antlr3 (1.8.12)
    arel (2.0.10)
    builder (2.1.2)
    composite_primary_keys (3.0.0.b3)
      activerecord (>= 3.0.1)
    erubis (2.6.6)
      abstract (>= 1.0.0)
    fast_xs (0.8.0)
    i18n (0.5.0)
    in_place_editing (1.2.0)
    jquery-rails (1.0.19)
      railties (~> 3.0)
      thor (~> 0.14)
    json (1.7.5)
    libxml-ruby (2.3.3)
    mail (2.2.19)
      activesupport (>= 2.3.6)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.19)
    mysql (2.8.1)
    mysql2 (0.3.11)
    net-sftp (2.0.5)
      net-ssh (>= 2.0.9)
    net-ssh (2.5.2)
    newrelic_rpm (3.4.1)
    nokogiri (1.5.5)
    polyglot (0.3.3)
    rack (1.2.5)
    rack-mount (0.6.14)
      rack (>= 1.0.0)
    rack-test (0.5.7)
      rack (>= 1.0)
    rails (3.0.12)
      actionmailer (= 3.0.12)
      actionpack (= 3.0.12)
      activerecord (= 3.0.12)
      activeresource (= 3.0.12)
      activesupport (= 3.0.12)
      bundler (~> 1.0)
      railties (= 3.0.12)
    railties (3.0.12)
      actionpack (= 3.0.12)
      activesupport (= 3.0.12)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.4)
    rake (0.9.2.2)
    rdoc (3.12)
      json (~> 1.4)
    ruby-ole (1.2.11.4)
    rubyzip (0.9.9)
    simple_xlsx_writer (0.5.3)
      fast_xs (>= 0.7.3)
      rubyzip (>= 0.9.4)
    spreadsheet (0.7.3)
      ruby-ole (>= 1.0)
    surpass (0.1.0)
    thor (0.14.6)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.33)
    will_paginate (3.0.3)
    xsd_xml_parser (0.0.4)
      nokogiri (>= 1.5.0)

PLATFORMS
  ruby

DEPENDENCIES
  activerecord-mysql2-adapter
  antlr3
  composite_primary_keys (= 3.0.0.b3)
  in_place_editing
  jquery-rails
  json
  libxml-ruby
  mysql
  mysql2
  net-sftp
  net-ssh
  newrelic_rpm
  nokogiri
  rails (= 3.0.12)
  rubyzip
  simple_xlsx_writer
  spreadsheet
  surpass
  will_paginate
  xsd_xml_parser (= 0.0.4)
4

1 に答える 1

0

table_alias最初に確認することは、そのメソッドをどこかで呼び出していますか? その関数を定義するのを忘れたのかもしれません...プロジェクトディレクトリでこれを試してください:

find . -type f | xargs grep "table_alias"

これにより、プロジェクト構造内の任意のファイルでそのメソッドが見つかります-存在する場合。

頭に浮かぶ別の可能性は、これは ActiveRecord であるため、データベースを初期化していないということです...rake dbコマンドを実行しましたか? たとえば、セッション ストアに ActiveRecord を使用するため、初期化は次のようになります。

bundle exec rake db:create:sessions
bundle exec rake db:migrate

コマンドもありrake db:setupます。

于 2012-08-29T17:59:40.830 に答える