I can't connect to my localhost using Ruby on Rails. I've made fresh installs (even using explicit commands like rails new test_app -d mysql
) but it never connects to the page. When I try localhost:3000 there's just a white page and the Firefox loading icon doesn't stop. When I first installed it, the startup screen loaded fine - but after adding resources it just hangs. I can add resources to the database fine using rake db:migrate
. Here's my database.yml:
development:
adapter: mysql2
host: localhost
username: root
password: root
database: limetree
socket: /tmp/mysql.sock
The test and production environments are the same setup. The weird thing is that I can add resources/tables to my database using the console - it's just my browser doesn't seem to be able to connect to the database using the app's controllers. I also think it might be a routing problem. The only line I changed in my routes.rb is:
root :to => "home#index"
Does anybody know why my Rails app isn't loading?
UPDATE:
Because I was running out-of-date versions (Ruby 1.8.7 and Rails 3.0.1) I reinstalled everything from scratch with the latest software. There was a minor issue with the rake gem which was resolved by reinstalling it. Everything now works fine.
尝试在配置文件中输入password: "root"
转到http:// localhost:3000 ,在Rails应用程序目录中打开文件log / development.log ,然后查看是否有任何有用的消息。
Make sure your MySQL server is actually running. You could try to use this in the routes file:
match ':controller(/:action(/:id(.:format)))'
既然已经设置了主页,请确保您有一个名为“ home”的控制器,并且有一个名为“ index”的操作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.