I have the sqlite3 gem in my Gemfile. Running 'bundle install' works without errors. When running a dababase migration using Rake:
rake db:create_migration NAME=create_messages
I get the following error:
rake aborted!
LoadError: Could not load 'active_record/connection_adapters/sqlite_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.
I even tried specifying sqlite3 with 1.3.3 and then with 1.3.4 versions in the Gemfile but that did not resolve the issue. Ruby version is 1.9.3
Following is from my environments.rb file:
configure :development do
set :database, 'sqlite:///dev.db'
set :show_exceptions, true
end
Following is from Gemfile:
source 'https://rubygems.org'
#ruby "1.9.3"
gem "sinatra"
gem "activerecord"
gem "sinatra-activerecord"
gem 'sinatra-flash'
gem 'sinatra-redirect-with-flash'
group :development do
gem 'sqlite3-ruby'
gem "tux"
end
I have also tried sqlite3 in place of sqlite3-ruby but that did not solve the issue.
Try this!
set :database, 'sqlite3:///dev.db'
This was resoved after upgrading to ruby v2.2.1 and updating all the gems again. I installed v2.2.1 via RVM.
Related
I tried starting Zammad from cPanel, and when I executed the command
bundle install --without test development mysql
I got an error about the version of Ruby in the Gemfile:
Your ruby version is 2.4.3 but your Gemfile specified 2.5.5
I manually changed the version of Ruby in the Gemfile, but the error persists. It seems that it does not support my modification:
source 'https://rubygems.org'
# core - base
ruby '2.4.3'
gem 'rails', '5.2.3'
# core - rails additions
gem 'activerecord-import'
gem 'activerecord-session_store
gem 'bootsnap', require: false
gem 'composite_primary_keys'
gem 'json'
gem 'rails-observers'
When trying to run bundle install on i receive the following exception:
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'minitest/autorun x64-mingw32' in any of the gem sources
listed in your Gemfile.
I was originally trying to run bundle exec rake, which suggests the same issue with gem 'minitest/autorun x64-mingw32'. Running them with rake test works fine; hence, I think I've done something wrong with bundler related to my OS (windows 7 x64). The install works properly without this package. I also tried using unit/test with the same result.
Ruby version is 2.4.4.
Gemfile:
source "https://rubygems.org"
gemspec
gem 'json', '~> 2.1.0', '>= 2.0.4'
gem 'addressable', '~> 2.5.2', '>= 2.5.2'
gem 'mongo', '~> 2.5.1', '>= 2.5.1'
group :test do
gem 'rake'
gem 'minitest/autorun'
end
Do I need to specify the platform or some other variable so that bundle looks for the right version of the gem on rubygems?
Any help would be much appreciated.
Using gem install, how can I add a gem to only one particular environment, like development or test or production? As seen below:
group :development do
gem 'web-console', '>= 3.3.0'
end
You can't do this via gem as the Gemfile is used by Bundler. However, since Bundler version 1.15.0 you can use bundle add:
bundle add web-console --group development
This will then add the following line to your Gemfile:
gem "web-console", "~> 3.6", :group => [:development]
I'm trying to start up an application in localhost made it with Sinatra and after running bundle install I got the following error:
/home/diego/.rvm/gems/ruby-2.3.1/gems/oj-2.14.6/lib/oj.rb:42:in `require': incompatible library version - /home/diego/.rvm/gems/ruby-2.3.1/gems/oj-2.14.6/lib/oj/oj.so (LoadError)
when I told rackup to start.
I already tried to uninstall the gem and re-install it. I also tried using the last version, but still got the same error.
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rack', '1.6.4'
gem 'sinatra', '1.4.5'
gem 'sinatra-advanced-routes', '0.5.3' ,:require => 'sinatra/advanced_routes'
gem 'rake', '10.5.0'
gem 'activerecord', '4.2.6'
gem 'activesupport', '4.2.6'
gem 'sinatra-activerecord', '2.0.9'
gem 'mysql2', '0.4.3'
gem 'unicorn', '5.0.1'
gem "typhoeus", '1.0.1'
gem 'i18n', '0.7.0'
gem 'newrelic_rpm', '3.15.0.314'
gem 'oj', '2.14.6'
gem 'oj_mimic_json', '1.0.1'
gem 'active_model_serializers', '0.9.5'
gem 'sinatra-respond_to', '0.9.0'
gem 'shotgun', '~> 0.9.1'
Finally I changed my ruby version to ruby 2.3.3 and works.
I am following along the Ruby on Rails Tutorial and have gotten somewhat confused in the testing section, in particular - 3.6.2 - Automated tests with Guard
As per the tutorial's instructions for deployment to Heroku, I've switched over to Postgresql and removed sqlite3 from my gemfile and did a bundle install to update.
However, once I run
bundle exec guard
I receive the message:
/Users/username/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.3/lib/bundler/rubygems_integration.rb:147:in block in replace_gem': Please install the sqlite3 adapter:gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)
I'm confused why I need this as sqlite3 has been removed from my environment?
My Gemfile is as follows:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'pg', '0.12.2'
group :development, :test do
gem 'rspec-rails', '2.9.0'
gem 'guard-rspec', '0.5.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
group :test do
gem 'rspec-rails', '2.9.0'
gem 'capybara', '1.1.2'
gem 'rb-fsevent', :require => false
gem 'growl', '1.0.3'
gem 'spork', '0.9.0'
end
I'm a bit confused because the Gemfile in the tutorial shows sqlite3 again even though it was removed in the previous section of the tutorial.
Update your database config file to use postgresql adapter:
adapter: postgresql
encoding: unicode
database:
username:
password: