I run rails generate controller welcome index
I got the warning
You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run gem pristine --all
I updated gem --system and also added paths into ~/.bashrc, but still same result, is there any suggestion?
Since I had an older Ruby version 2.0 from the past, so it made apache confuse. I could either explicitly telling apache to use which directory, or use RVM (Ruby Version Manager) which do all jobs. Just need to go through these steps:
Install RVM:
rvm get stable --auto-dotfiles
Then tell which version you tend to use:
rvm use 2.2.0
Update gems
gem install rails
Now ready to go!
Go to your Gemfile.lock and change your version of Ruby. That might do it.
What Ruby manager are you using?
Related
I am a beginner at Rails and when I typed in 'rails server' in Terminal, I received this error:
Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
I am using OSX Yosemite 10.10.5. I've tried installing it:
gem install mysql2
It still gave me the same error. I see that mysql2-0.4.0 is installed. Please help, thank you!
There is a bug in Rails 4.2.4 and previous, with the newly released 0.4.0 version of the mysql2 gem -- one part of Rails will accidentally refuse to use the newly released 0.4.0 version of mysql2.
The issue is reported here, although without a lot of details:
https://github.com/rails/rails/issues/21544
Until a new version of Rails is released that fixes this one way or another, add this to your Gemfile, specifying that mysql2 0.4.0 won't work:
# mysql 0.4.0 does not work with Rails 4.2.4
# https://github.com/rails/rails/issues/21544
gem 'mysql2', '>= 0.3.13', '< 0.4.0'
You previously probably just have gem 'mysql2' in your Gemfile -- add the version constraints as above, so it knows 0.4.0 won't work. Add the comments so you know why you did it, and can remove it later when no longer neccesary (probably whenever Rails 4.2.5 comes out).
Edit the Gemfile in your app like above, and then run bundle update mysql2 in your app directory, so your app will be using a mysql2 gem version 0.3.x again, as current Rails version wants.
When Rails 4.2.5 or later comes out and you upgrade to it, you will probably want to go back to your Gemfile and remove the version requirement specification for mysql2, return it to saying just gem 'mysql2' again. So your app will be willing to use the newer mysql2 0.4.0 gem, once Rails is willing to do so too.
add gem 'mysql2' to your Gemfile to specify the gems you want to use in your project
run bundle install which will install all gems, specified by Gemfile
run rails s should work fine
I've been trying to install a database as part of my ruby on rails setup.
I'm running a 64 bit windows 8, a x64 based machine.
My ruby version is 2.1.3p242, rails version is 4.0.0, sqlite3 version is 3.8.6 and postgresql version is 9.3
I first tried to install sqlite3 by following the steps given in this SO answer but I get this error
`require': Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid.
My database.yml has 'sqlite3' as the value for the adapter key for all three environments.
Next I try to installed postgresql which was installed properly. I fired up the pgadmin3 GUI and started the database server. But when I start the rails server. I get the following error
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `re
quire': cannot load such file -- 2.1/pg_ext (LoadError)
Thanks.
You need to use the pre release of pg.
Install
gem install pg -v 0.18.0.pre20141117110243 --pre
Add to your Gem file
gem 'pg', '~> 0.18.0.pre20141117110243'
Update with Bundle
bundle update
If you want to use PostgreSQL you'll need to do 2 things:
Install PostgreSQL on Windows using these instructions
Configure your rails project to use PostgreSQL this way:
rails new todo --database=postgresql
On the related note, if you want to do web development with Ruby on Rails, I recommend you to install Ruby, Gems, Git, Rails and IDE. All instructions are in the Start Programming Now book
In a Rails 4 app, I am trying to use ActiveAdmin 1.0.pre2. bundle install doesn't complain and seems to have included the gem and it works properly.
I am having this in my gem file:
gem 'activeadmin', github: 'gregbell/active_admin'
$> bundle show activeadmin
/home/aslam/.rvm/gems/ruby-2.1.0#monaeo/bundler/gems/active_admin-3fb7f03335b1
Even after running bundle install several times, I keep getting the following error:
git://github.com/gregbell/active_admin.git (at master) is not yet checked out.
Run `bundle install` first.
I am using
Bundler version 1.6.0.rc2 (upgraded from 1.5.3)
Ruby: ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]
Rails: 4.0.4
I am not sure what is going wrong here?
Try to install a prerelease version of Bundler:
gem install bundler --pre
It should solve the problem.
Use following in the Gemfile
gem 'activeadmin', :git => "git://github.com/gregbell/active_admin.git"
This way when you run bundle install, activeadmin would be sourced from its github repository.
Two things
A. You need to include like this in the gem file since 0.6.x is stable and maintained.
gem 'activeadmin', github: 'gregbell/active_admin', branch: '0-6-stable'
B. You can give a try by forking from the stable version of activeadmin
My solution:
rake rails:update:bin
bundle install
I'm starting to experiment with Rails 4 for work where we are using the MySQL2 3.1.0 gem on the server.
Locally with Ruby 2.0, I installed the MySQL2 3.1.0 Gem and everything was fine there (matching the gem version on the work server basically just to match the production server environment).
When I created a new Application (ruby new r4_test -d mysql) I ran into a problem though. Bundler crashed during the new application creation process complaining about missing MySQL2 3.1.3 files. It looks like 3.1.3 (released 3 months ago if I'm looking right) is the highest version number of the MySQL2 Gem. I'm confused about this because the only version of MySQL2 installed in the Ruby folder is version 3.1.0. Why did Bundler ignore the installed gem and expect a higher version that wasn't installed locally? I skipped Rails3 so I'm new to Bundler. It doesn't seem like it should expect a version that's not local though. Sometimes there are bugs or other issues where you need to stay on an older version of a gem for awhile too. ?
Thanks!
If you don't already have a Gemfile.lock in your project directory, Bundler tries to install the most recent version available that meets the version criteria in Gemfile. So, for a new Rails project, it will try to install the latest dependencies of the default generated Gemfile. It doesn't actually look at your installed gems at all unless you already have a Gemfile.lock.
You can use the --skip-bundle (or -B) if you don't want Rails to run bundle install when creating a new project. That gives you a chance to customize the Gemfile first. You can add in a version constraint if you want to be sure it will use the version you already have installed.
I want to install prawnto plug-in in my rails 3.0.6 application but when i fire the command as given here
rails plugin install git://github.com/thorny-sun/prawnto.git
it gives me result as given below
mkdir -p /var/www/octo11/vendor/plugins/prawnto
rm -rf /var/www/octo11/vendor/plugins/prawnto
which create and delete plugin directory automatically
Please anyone suggest me any alternatively to install the prawnto plugin. My system configuration is as given below
rails 3.0.6
ruby 1.8.7
ubuntu 11.04
thorny-sun seems to have deleted their fork, try one with recent updates, including docs on using with 3.1 in the readme:
https://github.com/forrest/prawnto
The best way to install seems to be using the gem version of this fork:
gem "prawnto_2", :require => "prawnto"
and then
bundle install