📜 ⬆️ ⬇️

Rails 3.0.0 + Ruby 1.9.2 + mysql2 manual

New rails came out, a new ruby ​​came out, and how to properly configure all this to work with mysql, so there is no information.
If you already have chop and rails, you can immediately go to the section "the most salt"

Install Ruby 1.9.2:

Downloading new Ruby from http://www.ruby-lang.org/en/downloads/
./configure --prefix=/usr/ruby I installed ruby ​​in the / opt / ruby ​​folder
make && make install

After that we make symlinks for the main files of new ruby:
ln -s /opt/ruby/bin/ruby /usr/bin/ruby
ln -s /opt/ruby/bin/rake /usr/bin/rake
ln -s /opt/ruby/bin/gem /usr/bin/gem

Installing Rails 3.0

gem install rails

Add a symlink:

ln -s /opt/ruby/bin/rails /usr/bin/rails
ln -s /opt/ruby/bin/bundle /usr/bin/bundle

For a normal installation of the mysql2 gem, you need mysql_config. We put it

sudo apt-get install libmysqlclient15-dev

After that we execute:

gem install mysql2

If everything went well, try to make a test project.

Salt itself

We try rake db: create and if we get an error like undefined method `errno 'for # <Mysql2 :: Error: 0x8fd09dc> we do the following. Create a patch
nano rake_db_create_fix.patch

Copy the content of the patch from the mouth http://pastie.org/1130299

further we execute

patch -p0 < rake_db_create_fix.patch

and enter the file name


/ opt / ruby ​​change on your way to cut. After performing the patch, everything worked out with a bang.

Source: https://habr.com/ru/post/103192/

All Articles