Padrino mit MySQL, Rake schlägt fehl
Frage
Ich möchte einfach den neuen Rahmen Padrino ausprobieren.Ich habe die angegebenen Schritte befolgt Hier.Ich stecke beim Ausführen der Rake-Aufgaben fest.Als Datenbank habe ich MySQL verwendet.Ich habe das Projekt mit dem Befehl erstellt.
padrino g project sample_blog -t sollte -e haml -c sass -s jquery -d activerecord -a mysql padrino g admin
Ich habe alle Abhängigkeiten in der richtigen Reihenfolge, das habe ich getan Bundle-Installation um es zu gewährleisten.Wenn ich dann die Rake-Aufgabe ausführe, erhalte ich diese Fehlermeldung.
$ padrino rake ar:create --trace
=> Rake wird ausgeführt ar:create --trace ...
** Rufen Sie ar:create (first_time) auf.
** Umgebung aufrufen (first_time)
** Umgebung ausführen
** Führen Sie ar:create aus
Rechen abgebrochen!
undefinierte Methode []' for nil:NilClass
Datenbank erstellen'
/usr/lib/ruby/gems/1.8/gems/padrino-gen-0.9.14/lib/padrino-gen/padrino-tasks/activerecord.rb:56:in
/usr/lib/ruby/gems/1.8/gems/padrino-gen-0.9.14/lib/padrino-gen/padrino-tasks/activerecord.rb:31
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call'
ausführen'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each'
ausführen'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain'
synchronisieren'
/usr/lib/ruby/1.8/monitor.rb:242:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain'
aufrufen'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task'
Höchststufe'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each'
Höchststufe'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling'
Höchststufe'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
/usr/lib/ruby/gems/1.8/gems/padrino-core-0.9.14/lib/padrino-core/cli/rake.rb:9:in init'
Rechen'
/usr/lib/ruby/gems/1.8/gems/padrino-core-0.9.14/lib/padrino-core/cli/base.rb:50:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/task.rb:33:in send'
laufen'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/task.rb:33:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/invocation.rb:109:in invoke'
Anruf'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/invocation.rb:116:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/invocation.rb:116:in invoke'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor.rb:137:in
Start'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/base.rb:378:in start'
Start'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor.rb:124:in
/usr/lib/ruby/gems/1.8/gems/padrino-core-0.9.14/bin/padrino:24
/usr/bin/padrino:19:in `load'
/usr/bin/padrino:19
$ padrino rake ar:migrate --trace=> Rake ar:migrate --trace wird ausgeführt ...
** Aufrufen von ar:migrate (zum ersten Mal)
** Umgebung aufrufen (first_time)
** Umgebung ausführen
** Führen Sie ar:migrate aus
Rechen abgebrochen!
ActiveRecord::ConnectionNotEstablished
/home/deepak/.bundle/ruby/1.8/gems/activerecord- 2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in retrieve_connection'
„recover_connection“
/home/deepak/.bundle/ruby/1.8/gems/activerecord- 2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in
/home/deepak/.bundle/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pecification.rb:115:in connection'
initialisieren'
/home/deepak/.bundle/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:440:in
/home/deepak/.bundle/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in new'
hoch'
/home/deepak/.bundle/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in
/home/deepak/.bundle/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:383:in migrate'
Anruf'
/usr/lib/ruby/gems/1.8/gems/padrino-gen-0.9.14/lib/padrino-gen/padrino-tasks/activerecord.rb:136
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute'
jede'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute'
invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize'
invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke'
invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level'
jede'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level'
standard_Exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level'
drin'
/usr/lib/ruby/gems/1.8/gems/padrino-core-0.9.14/lib/padrino-core/cli/rake.rb:9:in
/usr/lib/ruby/gems/1.8/gems/padrino-core-0.9.14/lib/padrino-core/cli/base.rb:50:in rake'
schicken'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/task.rb:33:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/task.rb:33:in run'
aufrufen'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/invocation.rb:109:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/invocation.rb:116:in call'
aufrufen'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/invocation.rb:116:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor.rb:137:in start'
Start'
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor/base.rb:378:in
/usr/lib/ruby/gems/1.8/gems/thor-0.13.4/lib/thor.rb:124:in start'
Belastung'
/usr/lib/ruby/gems/1.8/gems/padrino-core-0.9.14/bin/padrino:24
/usr/bin/padrino:19:in
/usr/bin/padrino:19
Lösung
ActiveRecord::ConnectionNotEstablished
Haben Sie Ihren MySQL-Benutzernamen und Ihr Passwort in die Datenbank.rb eingegeben?