I would like to how we can install mysql in rails in newer version ruby installed?
I tried this command below:
gem install mysql2
But I've got an error below:
I'm using windows 10 home, already installed ruby installer and run some rails app(using sqlite db).
if you creating new rails application with mysql
rails new app_name -d mysql
Related
I am starting a new project that we decided to try out with Rails ... so I just installed Ruby via the Windows Installer and then, as is suggested on the Rails website, I run
gem install rails
rails new path/to/your/new/application
(replacing the path with my real project name) and I get the error that it failed complaining about JSON and that it can't build native extensions.
The Ruby on Rails home page tells you to install Ruby.
On the installer download page it says
If you don’t know what version to install and you’re getting started
with Ruby, we recommend you use Ruby 2.1.X installers
Ignore that. On the Ruby on Rails home page it says what version to install.
We recommend Ruby 2.2 or newer for use with Rails.
Then the Ruby on Rails home page says to run the following commands:
gem install rails
rails new path/to/your/new/application
cd path/to/your/new/application
rails server
The above won't work. The new rails project will fail.
What the steps above don't tell you is that, after running the installer, download and install the DevKit.
So ...
Download version of Ruby recommended on Ruby home page
Install Rails via gem install rails
Download DevKit
Then create Rails project by running last three commands above.
I am new to cloudfoundry and rails, I am trying to deploy a new application to cloudfoundry, and I got this error:
====> /logs/migration.log <====
←[31mYou have requested:
mysql2 ~> 0.3.11
The bundle currently has mysql2 locked at 0.3.11.
Try running `bundle update mysql2`←[0m
I downloaded a few rails samples from here:
https://github.com/cloudfoundry-samples
with the same results.
I already tried 'bundle update mysql2'
If I push a simple ruby app that requires the gem mysql2 it works fine.
I am using windows 7 x64.
Any ideas?
Thanks.
There is an issue with deploying ruby apps bundled on Windows to CloudFoundry.com (which is Linux-based). The workaround is to modify your Gemfile.lock and delete occurrences of the string -x86-mingw32. Then re-push the app to Cloud Foundry.
can you confirm that you have run;
bundle update
bundle package
before using VMC to push the application.
I am trying upgrade Rails. I am pretty sure that Rails 3.1 is now installed, however my rails apps still have no Gemfile, and rails -v returns 2.3.5. When I type "gem uninstall rails" I get:
aheine#ubuntu:~/www$ gem uninstall rails
Select gem to uninstall:
1. rails-3.0.9
2. rails-3.1.0.rc1
3. rails-3.1.0.rc5
4. All versions
How can I get rid of Rails 2, and make rails 3 the default version to use?
I am using Ubuntu 11.04
Your running with the system provided Rails, run apt-get remove rails and then you may need to make a configuration change so the system can find the proper rails command. So see if that works and then try running rails -v if that returns command not found add this line to the beginning of your .bashrc file in your home directory.
export PATH=/var/lib/gems/1.8/bin:$PATH
After that's done open a new shell and try running rails -v again.
I've got Snow Leopard with Rails 2.3.5 installed along with other versions (2.2.2 and 1.2.6). I'd like to use 2.2.2 as the webserver I want to deploy to uses a 2.2.x version of Rails. I've tried to uninstall Rails 2.3.5 but get this error:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d rails`
Is there any other way of setting the Rails version to one of the other installed Rails versions?
You should really take look to RVM(Ruby Version Manager) it's awesome!
https://rvm.io
http://teachmetocode.com/screencasts/rvm-ruby-version-manager/
Cheers
Denis
You should be able to do this without needing to uninstall anything. You can specify the version of rails you want to create an application for by typing the following when creating a new app.
rails _2.2.2_ app_name
I've just upgraded my rails version to rails 3.0.
But suddenly I need a new rails app with old version of rails.
I know the new version of rails change command line usage with rails new.
How can I create an old version of Rails in this new Rails 3 environment?
Use the following command:
rails _2.3.5_ new APP_NAME
This will create a rails project with version 2.3.5
Leonid Shevtsov provided instructions for how to do this here.
The easiest way to do it was:
Create the directory for the project
Create a Gemfile there containing
gem "rails", "2.3.9"
gem "sqlite3-ruby", :require => "sqlite3"
Runbundle install
Run bundle exec rails . to create an app in the current path
You don't even need rvm to do this.
If you need to switch back and forth, I would recommend using RVM. You can install different versions of Ruby and each can have its own set of gems. I use my system installed ruby (1.8.6?) on my Mac for Rails 2 dev, and then I installed Ruby 1.9.2 with RVM for my Rails 3 dev. Its as simple as doing this after you have RVM installed:
#install and use 1.9.2 for Rails 3
rvm install 1.9.2
rvm 1.9.2
rails new whatever
#switch back to system installed ruby for Rails 2
rvm system
rails whatever