I am new to Ruby, previously I installed an older Ruby and gem versions and I create one sample project.
Now I...
uninstall the Ruby and all using uninstall program via control panel.
install new versions of ruby and all.
run the server - it throws a lot of errors.
I solved some problems but I am not able to solve the Gem::LoadError and rake db:migrate errors.
Please help me. Thanks in advance.
Try to add gem sqlite3 into your Gemfile and then run bundle in console.
It should look something like this
Gemfile
source 'https://rubygems.org'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
Related
I installed ruby (along with development kit) and then I installed rails using the command gem install rails.
I am looking to start a new rails project, however it is throwing an error, and asking to make sure that
gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/
succeeds before bundling.
I ran the above command, but I got an error as follows:
I am following these two links to start a rails project or on how to install SQLite in windows.
https://guides.rubyonrails.org/getting_started.html
https://skorks.com/2009/08/installing-and-using-sqlite-with-ruby-on-windows/
I also manually downloaded the sqlite files from the sqlite download page and copied them to C:/ruby/bin folder
Looking for a way to start a new project in rails with no sqlite3 issues.
Add the following line into your project Gemfile and bundle install again.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
This will fix your problem.
Whenever i run my rails server command on my command prompt it gives me the following error:
Since i am new to the Rails, I don't know much about it.
Guide me with the solution if possible..
I am using rails 5 on windows OS
Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile
As your error says please add mysql2 in your Gemfile
# Gemfile
gem 'mysql2'
Also make sure you have mysql installed
The answer to your question is in the error message. You're using mysql2 as your database adaptor, but the gem isn't available.
add:
gem 'mysql2'
to your gemfile, then run bundle update from your project folder to install the missing gem.
You need to add
gem 'mysql'
in your Gemfile.
If its added then run command bundle install to install it. And check whether its installed successfully or not then restart server.
Also check your gem version with your Rails version.
I am a newbie so please bear with me :)
I am currently working on my personal project running on rails 5.0.0.rc2. How can I best upgrade my project to use the latest version 5.0.0?
I did some research and found that I could just easily change the rails gem in Gemfile and run 'bundle update rails'. I don't know if this is the best way, but if it's not, what's the best way?
Thanks!
Go to your Gemfile, check gem 'rails' and set it's version like this
gem 'rails', '5.0.0'
the use bundle to install it by running
bundle install
or
bundle
you may encounter some dependencies that require you to run
bundle update
Changing the rails version in the Gemfile would be enough. Also be sure to check out railsdiff.org for changes in the project directory (config files, etc.)
I am having a problem getting an old Ruby on Rails 2 app that hasn't worked in a year to work.
I'm trying to run rake test:functionals in the root of my project directory, but am getting undefined method 'name' for "SystemTimer":String.
I've pasted everything that I believe relevant to the problem here:
http://pastebin.com/NgBvystZ
Also, when I run rake itself, I get
Errors running test:units!
Not sure how to debug that.
I have copied and pasted everything that I think would be useful to understanding this problem. Your time is greatly appreciated. Thank you.
This is an incompatibility between versions of RubyGems greater than 1.3.7 and versions of Rails less than 2.3.12. There are a few ways to solve this.
Use Bundler
Bundler is easy to install, fixes this problem, and has a number of other advantages as well. I highly recommend it.
Upgrade to Rails 2.3.12 or higher
Rails 2.3.12 fixed compatibility issues with RubyGems 1.8.5 (see release report).
Downgrade to RubyGems 1.3.7
I would not recommended this unless you have no other choice. Use this command: gem update --system 1.3.7. Also, version 1.7.2 has partial compatibility (it will run, but freezing gems will fail and there are likely other issues).
I chanced upon this thread, because I got the following error when migrating some Radiant 0.9.1 installations to a new server:
undefined method `name' for "RedCloth":String
(3) The compromising solution: I haven't tested this personally, but I hear that rails 2.3 with bundler is compatible with the latest rubygems. If you're interested in this solution, see http://gembundler.com/rails23.html for getting bundler to work under rails 2.3.
For me solution 3 was the only option, since we had other apps needing the latest rubygems on the system.
Just install bundler and follow thes steps on this page:
http://gembundler.com/rails23.html
And put this in a file called "Gemfile" in the app root:
source :gemcutter
gem "radiant", "0.9.1"
gem "sanitize"
gem "fastercsv"
gem "rmagick"
gem "rack", "~> 1.1.0"
gem "rake", ">= 0.8.3"
gem "RedCloth", ">= 4.0.0"
gem "will_paginate", "~> 2.3.11"
gem "mysql"
This is just my example. Start with only the first 2 lines, run bundle update and reload the page to see what else you might be missing.
Thank you Ben!
I am trying to run Rails3 on XP Profesoinal and following the tutorial here http://railstutorial.org and am receiving the following errors all the time, even trying to return static pages. The message is the procedure entry point rb_str2cstr could not be located in the dynamic link library msvcrt-ruby191.dll
Also, the page gives a runtime error "no driver for sqlite3 found" even though i haven't created any models yet. The sqlite3.exe, sqlite3.dll and sqlite3.def are all in the bin folder and I have run Gem install sqlite3-ruby.
I have also tried gem install mongrel --pre and the instructions given http://www.ruby-forum.com/topic/202770#882858, but nothing is working
Here is my minimal fix for the problem:
ruby -v => 1.9.2p0
rails -v => 3.0.0
gem -v => 1.3.7
download sqlitedll-3_7_3.zip from http://sqlite.org/download.html
copy sqlite3.def and sqlite3.dll to ruby/bin
edit Gemfile:
gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3'
del Gemfile.lock
bundle install
rake db:migrate
Ruby 1.9.2, Rails 3.0
rake db:migrate produces the error message:
The procedure entry point rb_str2cstr could not be located in the dynamic link library msvcrt-ruby191.dll
Resolved by the following:
Delete gemlock.
Change SQLite version to 1.3.1.
Run: bundle install.
rake db:migrate now produces the correct results.
My versions:
ruby -v => 1.9.2p0
rails -v => 3.0.0
gem -v => 1.3.7
Gemfile:
gem 'sqlite3-ruby', :require => 'sqlite3'
Then:
Deleted Gemfile.lock
rake db:migrate
This fixed the error that you mentioned (The same windows pop-up).
Metoo. I was trying to run rake db:migrate on Vista-64. (same book).
Follow-up: I had been trying to solve some other problem by uninstalling and re-installing things and probably messed things up. When I ran into this problem no amount of 'gem uninstall' or 'bundle install's would solve it. Until I removed my Gemfile.lock and did a 'Bundle install'. Then my 'rake db:migrate' ran w/o error. It didn't look like bundle installed anything since all output was 'Using xxx', but I'll take it.
for me this meant "“you need to update your sqlite3-ruby gem version somehow" http://betterlogic.com/roger/?p=3027
I had the same problem with XP Pro and the Rails tutorial. I had SQLite version 1.2.5 installed, which matched what it says in Chapter 2 of the tutorial.
But when I saw roger's comment about using version 1.3.1, I installed that version (using "gem install sqlite3-ruby -v 1.3.1"). But it gave a message about using SQLite version 3.6.23.1 with this gem, along with the relevant website. So I downloaded it and replaced the sqlite3 .exe, .dll and .def files in the C:\Ruby192\bin directory.
Then I looked in the gemfile and saw that the SQLite version was 1.2.5 (as per the tutorial). So I changed it to 1.3.1, deleted gemfile.lock, ran "bundle install" again, and after that "rake db:migrate" worked.