I am desperately in need of help from any charitable ruby/rails experts out there. I really want to learn RoR, but I can't get anywhere because every time I get to the stage where I need to connect to the database, something is messed up. Here's what I've got going at the moment.
[ Mac OSX 10.6.6 -- Ruby 1.9.2 -- Rails 3.0.5 -- MySQL 5.5.10 ]
All of these are the latest versions, freshly installed, and running smoothly. I also have rvm installed. All I want to know is how I can set up a new Rails project using a MySQL database and connect to it properly. I have spent countless hours googling around and getting error after error after error.
Can anyone help me out by outlining step by step how I can just get a working rails project connected to a mysql database? If anyone can help me with this I will not only owe you my life, but I will make amazing web and interface designs for you for free and/or collaborate 开发者_Python百科on your next project as a UI designer. I will in addition give you free photoshop/graphics advising for life.
I want to learn rails so so bad, but I am in over my head right now with this file configuration stuff and wasting massive amounts of time. Please help!
You'll owe me your life!!!! WOW! Seriously, try this:
rails new example -d mysql
config.database.yml created
development:
adapter: mysql2
encoding: utf8
database: example_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
Go into your new project
cd example
Then install gems needed (mysql2)
bundle install
Then create your database
rake db:create
Profit!
If you can't use /var/run/mysqld/mysqld.sock as a pointer to connect to your mysql, then edit it to look like this https://gist.github.com/878434 and customize the port and username/password
Give a look at this post here :http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails/
精彩评论