2012-01-16 7 views
0

レールとスプレー宝石(http://spreecommerce.com/)を使ってオンラインショップを作りたかったのです。醸造とhttp://tecparatodos.com/2011/07/24/installing-ruby-on-rails-on-mac-os-x-lion/とMySQL:SpreeのインストールActiveRecord :: ConnectionNotEstablished Error

は、どこでもMy Mac(OS Xのライオン)にしばらくの間、レールに開発休息を残して、私は、このガイドを使用して最初からすべてをインストールしました。

私も続いシュプレーの「ドキュメントをはじめ、」発生したhttp://guides.spreecommerce.com/getting_started.html

問題は、データベースを構成した後、MySQLを使用して、例えばということですすると、常にActiveRecord :: ConnectionNotEstablishedエラーが発生します。最初に私はそれが私のmysqlインストールと関係があると思ったが、何時間も点検して再インストールした後、私はそれが実際に酒宴の宝石のためであったということを理解した。 Gemfileに "gem 'spree'"を追加すると、このエラーが発生します。私はそれを削除し、 "バンドルのインストール"を行うと、すべて正常に動作します。私はビュープロジェクトでいくつかのレール体験をしていますが、拍手は私には新しいものです。どのような問題が起こる可能性がありますか?

マイdatabase.ymlの:

development: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: asiashop_development 
    pool: 5 
    username: root 
    password: 
    socket: /tmp/mysql.sock 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: asiashop_test 
    pool: 5 
    username: root 
    password: 
    socket: /tmp/mysql.sock 

production: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: asiashop_production 
    pool: 5 
    username: root 
    password: 
    socket: /tmp/mysql.sock 

そして、私がやるstracktraceは "Cレール":

/Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished) 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.0.rc2/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.0.rc2/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.0.rc2/lib/active_record/model_schema.rb:224:in `columns' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.0.rc2/lib/active_record/model_schema.rb:244:in `column_names' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/ordering.rb:61:in `ordering_condition_details' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/ordering.rb:52:in `method_missing' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/spree_core-0.40.0/lib/spree_core/find_by_param.rb:105:in `<class:Base>' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/spree_core-0.40.0/lib/spree_core/find_by_param.rb:104:in `<top (required)>' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:251:in `require' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:251:in `block in require' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:251:in `require' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/spree_core-0.40.0/lib/spree_core.rb:47:in `<top (required)>' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/spree-0.40.0/lib/spree.rb:1:in `require' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/spree-0.40.0/lib/spree.rb:1:in `<top (required)>' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' 
    from /Users/mark/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' 
    from /Users/mark/Documents/Workspace/Asia Testshop/asiashop/config/application.rb:7:in `<top (required)>' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:39:in `require' 
    from /Users/mark/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:39:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

私が書いたように、それはすべての作品のための一般的なMySQLのconenctionの問題になることはできません私は酒宴の宝石を使用しない限り、細かい。

+0

この問題でより大きなスタックトレースを提供できますか? 'config/database.yml'をどうやって設定しましたか? Railsアプリケーションにはデフォルトでsqlite3が付属しているので、あなたは何か異なることをしているに違いありません。 –

+0

私はspree gemを使用しない限り、問題なく動作するmysqlを使用しています。上記のstracktraceとdatabase.ymlを追加しました。どうも! –

答えて

5

あなたはこのようなあなたのGemfileに宝石としてシュプレーを追加する必要があります:

gem 'spree', '0.70.3' 

これは、最新の安定版のSpreeをインストールします。この問題は、BundlerがSpreeの非常に古いバージョン(0.40.0)を実行するように選択していることが原因であると思われますが、これは間違っています。

+0

gemの最新バージョンがデフォルトでインストールされることはありませんか? – Lavixu

+1

@Lavixu他の宝石の宝石依存の仕様に最新のもの以外のものが必要な場合はありません。 'gem 'spree'をするということは、"私はSpreeの任意のバージョンが欲しい " –

0

本当に問題の原因を突き止めるが、すべての宝石をアンインストールしてから、最初からそれらを再インストールした後、私はそれが働いて得たことはできません。..

関連する問題