I know session_store has removed from Rails 4.
So I try install it, but have some errors:
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'activerecord-session_store', github: 'rails/activerecord-session_store', plataform: :mri
Console
Bundle Install
C:\Sites\rails-estudo-blog>bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.10)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using sqlite3 (1.3.8)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Sites\rails-estudo-blog>
Trying install the gem
C:\Sites\rails-estudo-blog>rails generate active_record:session_migration
Could not find generator active_record:session_migration.
Trying create a session store migration
C:\Sites\rails-estudo-blog>rails generate active_record:session_migration
Could not find generator active_record:session_migration.
C:\Sites\rails-estudo-blog>
Informations
Rails 4.0
Ruby 2.0
Windows 7 x64 Professional
What's wrong? I follow all the steps of the repository: https://github.com/rails/activerecord-session_store
Works!
I re-write the file, and works (I don't know the problem), but I have another problem (I use proxy).
$ bundle install
Fetching git://github.com/rails/activerecord-session_store.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=No error
Git error: command `git clone
"git://github.com/rails/activerecord-session_store.git"
"c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/cache/bundler/git/activerecord-session_store-cf0cfe22b7614cc4fcd416e139ff2bd62ebd6f1d"
--bare --no-hardlinks` in directory c:/Sites/rails-estudo-blog has failed.
Solved
I can solve the problem change the url to:
gem 'activerecord-session_store', git: 'https://github.com/rails/activerecord-session_store'
So, I change github to git and put the entire url I want.
Thanks!
Update with new answer:
After you provided the entire Gemfile, I copied it and tried it directly. I saw the same problems you had. So, I retyped the line. It worked. I can't say exactly what is wrong within the line, but this works:
gem 'activerecord-session_store', github: 'rails/activerecord-session_store'
Copy and try it. If it still fails, delete it and retype it. The original line was just ignored without any message or reason and the bundle succeeded but missed this gem. The newly typed line worked. Go figure.
I left out "plataform: :mri", corrected to "platform: :mri", as it was extraneous.
Be sure to still follow the steps outlined below in my original answer. They still apply.
Please let me know..
End of update with new answer. Old answer follows:
I tried this for you, updating Gemfile and running bundle install. The result added the desired gem, and you can see the initial fetch from git (This was executed with Rubymine, thus the complex command line.):
D:\BitNami\rubystack-1.9.3-12\ruby\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/BitNami/rubystack-1.9.3-12/projects/utilities/bin/bundle install
Fetching git://github.com/rails/activerecord-session_store.git
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
...
Using activerecord-session_store (0.0.1) from git://github.com/rails/activerecord-session_store.git (at master)
...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Process finished with exit code 0
Checking the status, I found:
D:\BitNami\rubystack-1.9.3-12\projects\utilities\app\helpers>bundle show activerecord-session_store
D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/bundler/gems/activerecord-session_store-022d45b4ae9b
Running the generate created the migration:
D:\BitNami\rubystack-1.9.3-12\projects\utilities>rails generate active_record:session_migration
create db/migrate/20131002090526_add_sessions_table.rb
The migration is as follows:
class AddSessionsTable < ActiveRecord::Migration
def change
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id, :unique => true
add_index :sessions, :updated_at
end
end
Interestingly, gem list didn't show the gem I expected, even though the bundle and generate worked:
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem list activerecord-session_store
*** LOCAL GEMS ***
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem list activerecord-session_store -r
*** REMOTE GEMS ***
activerecord-session_store (0.0.1)
But, gem install fixed that:
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem install activerecord-session_store
Fetching: activerecord-session_store-0.0.1.gem (100%)
Successfully installed activerecord-session_store-0.0.1
1 gem installed
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem list activerecord-session_store
*** LOCAL GEMS ***
activerecord-session_store (0.0.1)
Recommendations:
Run the gem install to make sure you have it installed.
Run the gem list to double check.
Run bundle update, not bundle install, to build the bundle from scratch.
Check the listing to ensure the gem is included as expected.
Run the bundle show to double check, again...
Run the rails generate to generate the migration.
If the migration fails to run again, check your gem storage for the generator in your gem storage:
.../gem/activerecord-session_store-0.0.1/lib/active_record/session_store.rb
Related
I am currently have Ruby version 2.2.6 installed on my Windows 10 machine but need to update order to use the shopify_app gem. I downloaded Ruby 2.5.1-2 (x64) wıthout the devkit as it says on the Ruby Installer site and followed the prompts. I seemingly finished the installation , but entering ruby -v in the command line tells me I am still useing version 2.2.6. I have also tried bundle update which gives the following:
C:\Sites\postgresapp>bundle update
The dependency byebug (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86-mingw32 but the dependency is only for ruby. To add those platforms to the bundle, run `bundle lock --add-platform ruby`.
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies........
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.0.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.0.7
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.4 (x86-mingw32)
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.0.7
Using rack 2.0.5
Using rack-test 0.6.3
Using actionpack 5.0.7
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.0.7
Using globalid 0.4.1
Using activejob 5.0.7
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.0.7
Using activemodel 5.0.7
Using activemodel-serializers-xml 1.0.2
Using arel 7.1.4
Using activerecord 5.0.7
Using activeresource 5.0.0
Using bindex 0.5.0
Using bundler 1.16.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.0.7
Using coffee-rails 4.2.2
Using multipart-post 2.0.0
Using faraday 0.12.2
Using ffi 1.9.25 (x86-mingw32)
Using graphql 1.8.5
Using graphql-client 0.13.0
Using hashie 3.5.7
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.3
Using jwt 1.5.6
Using multi_xml 0.6.0
Using oauth2 1.4.0
Using omniauth 1.8.1
Using omniauth-oauth2 1.5.0
Using omniauth-shopify-oauth2 1.2.1
Using pg 0.21.0 (x86-mingw32)
Using puma 3.12.0
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.0.7
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.7
Using tilt 2.0.8
Using sass-rails 5.0.7
Using shopify_api 4.12.0
Fetching shopify_app 8.2.6
Installing shopify_app 8.2.6
Gem::InstallError: shopify_app requires Ruby version >= 2.3.1.
An error occurred while installing shopify_app (8.2.6), and Bundler cannot
continue.
Make sure that `gem install shopify_app -v '8.2.6' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
shopify_app
EDIT: ADD GEMFILE
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'shopify_app', '~> 8.2.6'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.6'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'simple_form'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
"gem 'shopify_app'"
How can I complete the installation of the latest version of Ruby?
You need to update your PATH environment variable, it is still pointing to the old installation. If I remember correctly, the installer does have a box to check off to set the PATH variable. Only one installation at a time can be in your PATH.
See this answer for a quick way to change the variable. It will follow the same syntax as the following.
Open cmd.exe and type:
set PATH=%PATH%;C:\Ruby250\bin
Your installation location may be different, confirm before entering. You can also do it through the properties window of MyComputer or whatever they call it now. I find the terminal to be simpler, as it take abouts 6 windows deep to change through the GUI.
Step By Step:
Find the directory where ruby is installed to, usually
C:\Ruby250\bin (version may vary)
Open a command prompt, terminal, cmd.exe, or whatever name you
prefer to call it.
Type set PATH=%PATH%;C:\Ruby250\bin (change folder name if yours
is different)
Press Enter button
In a new cmd.exe, type ruby -v
Enjoy
ANOTHER EDIT
Click on the "Start" button (probably bottom-left of your screen)
Start typing the word "environment" until you see the option Edit
the system environment variables appear
Click on that
A small window will open, towards the bottom left is a button that
reads Environment Variables
Click on that button
There will be two sections, one for the user (that is current account
only) and the other is the "system", which is the default and
system-wide variables
In each of these (just to be sure), highlight the line that has
"Path" for the name of the variable
Find the button under the list that you just clicked in that reads
Edit...
Click on it
Look through list, it is different for everyone, can't read it for
you. Find the one that it is the location of a Ruby installation,
mine reads C:\Ruby24\bin because I am using Ruby 2.4.4
YOU NEED TO MAKE SURE THAT THE FOLDER PATH IS WHERE YOU INSTALLED
RUBY. This cannot be done for you, only you know. It is by default
C:\RUBY***\bin, where the *** is your version number. You have to
open explorer and simply look.
If the variable is where is where Ruby 2.5 is installed, good, it
doesn't need changed, but look through the list to make sure there
are no other paths to other versions of Ruby. If there are, highlight
them and click the delete the button to remove.
Click OK on each window that you may have made an edit, not
Cancel, and not X out the window.
To confirm it works, open a new command window, if one was already
open, the changes will not be updated in it.
I'm brand new to Docker and fairly new to Rails.
When I run docker-compose up, I get this error:
web_1 | bundler: command not found: rails
web_1 | Install missing gem executables with `bundle install`
app_web_1 exited with code 127
Initially I had trouble getting it to find any gem when running bundle install. I was getting a "Could not find gem in any of the sources" error for every single Gem in my Gemfile. I then attempted to run bundle (without install) and it returned no errors.
Rails is definitely installed, as typing rails gives me all of it's usage options.
Also, I can see the gems in vendor/cache. I tried removing all of them and running bundle install and they all start appearing one by one as the bundler installs them.
EDIT: Please feel free to correct my understanding: since running bundle install is meant to install the gems on the Docker instance, it is not being installed "locally". While attempting to troubleshoot this issue, I deleted all my gems locally and re-installed bundler. So, when I run gems list, I only see bundler. I ran bundler install and it claims that all the gems are being installed. Where are they being installed? It says it's going to vendor/cache, and that's true. I can see them there, yet it still fails to find any gems: it won't even find rails.
EDIT 2: I should also mention: bin/rails s starts the server just fine. It won't load anything due to the database instance not running, but that makes sense I guess.
EDIT 3: I ran gem install rails locally, still no change but now gems list returns rails and its dependencies.
Below are some files and logs that may be relevant below and could help determine the cause. Please note I changed the actual application name to app.
Running gems list returns this:
*** LOCAL GEMS ***
actionmailer (5.1.1)
actionpack (5.1.1)
actionview (5.1.1)
activejob (5.1.1)
activemodel (5.1.1)
activerecord (5.1.1)
activesupport (5.1.1)
arel (8.0.0)
builder (3.2.3)
bundler (1.15.0)
concurrent-ruby (1.0.5)
erubi (1.6.0)
globalid (0.4.0)
i18n (0.8.1)
loofah (2.0.3)
mail (2.6.5)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.2)
nio4r (2.0.0)
nokogiri (1.7.2)
rack (2.0.3)
rack-test (0.6.3)
rails (5.1.1)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.3)
railties (5.1.1)
rake (12.0.0)
sprockets (3.7.1)
sprockets-rails (3.2.0)
thor (0.19.4)
thread_safe (0.3.6)
tzinfo (1.2.3)
websocket-driver (0.6.5)
websocket-extensions (0.1.2)
My Gemfile looks like this:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'gmail'
gem 'oauth', '0.5.2'
gem 'twilio'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use postgres as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
My docker-compose.yml file looks like this:
version: '2'
services:
db:
image: postgres
volumes:
- ./postgres-data:/var/lib/postgresql/data
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/app
ports:
- "3000:3000"
depends_on:
- db
My Dockerfile looks like this:
FROM ruby:2.4.0
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
ADD . /app
Running bundle install returns this:
Using rake 12.0.0
Using oauth 0.5.2
Using mime-types-data 3.2016.0521
Using builder 3.2.3
Using multi_xml 0.6.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.1
Using minitest 5.10.2
Using thread_safe 0.3.6
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 2.0.3
Using nio4r 2.0.0
Using websocket-extensions 0.1.2
Using arel 7.1.4
Using method_source 0.8.2
Using thor 0.19.4
Using bundler 1.15.0
Using pg 0.20.0
Using puma 3.8.2
Using sass 3.4.24
Using tilt 2.0.7
Using execjs 2.7.0
Using coffee-script-source 1.12.2
Using turbolinks-source 5.0.3
Using multi_json 1.12.1
Using byebug 9.0.6
Using bindex 0.5.0
Using rb-fsevent 0.9.8
Using ffi 1.9.18
Using gmail_xoauth 0.4.2
Using mime-types 3.1
Using httparty 0.15.5
Using tzinfo 1.2.3
Using nokogiri 1.7.2
Using rack-test 0.6.3
Using sprockets 3.7.1
Using websocket-driver 0.6.5
Using uglifier 3.2.0
Using coffee-script 2.4.1
Using turbolinks 5.0.1
Using rb-inotify 0.9.8
Using mail 2.6.5
Using twilio 3.1.1
Using activesupport 5.0.3
Using loofah 2.0.3
Using listen 3.0.8
Using gmail 0.6.0
Using rails-dom-testing 2.0.3
Using globalid 0.4.0
Using activemodel 5.0.3
Using jbuilder 2.6.4
Using spring 2.0.1
Using rails-html-sanitizer 1.0.3
Using activejob 5.0.3
Using activerecord 5.0.3
Using spring-watcher-listen 2.0.1
Using actionview 5.0.3
Using actionpack 5.0.3
Using actioncable 5.0.3
Using actionmailer 5.0.3
Using railties 5.0.3
Using sprockets-rails 3.2.0
Using coffee-rails 4.2.1
Using jquery-rails 4.3.1
Using web-console 3.5.1
Using rails 5.0.3
Using sass-rails 5.0.6
Updating files in vendor/cache
Bundle complete! 18 Gemfile dependencies, 68 gems now installed.
Bundled gems are installed into ./vendor/cache.
I am not sure if this is a proper solution, but I tried adding
RUN bundler install
to my Dockerfile. I deleted all of the images, ran docker-compose up and worked like a charm.
Another possible solution that worked for me is to create a docker-entrypoint.sh file in the root of your project similar to this:
#!/bin/bash
bundle install --jobs 20 --retry 5
and add this steps in your Dockerfile
# allows a shell script to run before any relative containers execute a command.
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
This way you have the possibility to run this shellscript file around the initialization of your container. You can read more about this here: https://success.docker.com/article/use-a-script-to-initialize-stateful-container-data
Just in case someone facing a similar issue. This might help.
Docker env you may want to set up your bundler specific case.
For example:
Use system folder for bundler and gems
# Docker file
ENV BUNDLE_PATH="/usr/local/bundle"
ENV GEM_HOME="/usr/local/bundle/gems"
ENV GEM_PATH="/usr/local/bundle/gems"
Or you can use vendor if you loading in your source code into Dockerfile.
ENV BUNDLE_PATH="vendor/bundle"
ENV BUNDLE_APP_CONFIG=".bundle"
And please check out this article from bundler team.
https://bundler.io/guides/bundler_docker_guide.html
I know this question is asked many times. I also tried all the things written on internet to fix it but I cannot.
When I run rails generate controller command, I get this error in my command line. By the way, I used to get this error in the browser but I created project with 4.2.2, instead of 4.2.4, and I don't get this error in browser.
This is Gemfile.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Twitter's Bootstrap, converted to Sass and ready to drop into Rails or Compass
gem 'bootstrap-sass', '~> 3.3.5.1'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Bundle install:
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.2
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.2
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.2
Using globalid 0.3.6
Using activejob 4.2.2
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.2
Using activemodel 4.2.2
Using arel 6.0.3
Using activerecord 4.2.2
Using execjs 2.6.0
Using autoprefixer-rails 6.0.3
Using bcrypt 3.1.10
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using sass 3.4.18
Using bootstrap-sass 3.3.5.1
Using byebug 6.0.2
Using coffee-script-source 1.9.1.1
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.2
Using coffee-rails 4.1.0
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using jquery-rails 4.0.5
Using mysql2 0.3.20
Using bundler 1.10.6
Using sprockets 3.3.5
Using sprockets-rails 2.3.3
Using rails 4.2.2
Using rdoc 4.2.0
Using tilt 2.0.1
Using sass-rails 5.0.4
Using sdoc 0.4.1
Using spring 1.4.0
Using turbolinks 2.5.3
Using uglifier 2.7.2
Using web-console 2.2.1
Bundle complete! 14 Gemfile dependencies, 56 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
What should I do? Thank you.
EDIT:
I did try: gem 'mysql2', '~> 0.3.18' but doesn't work.
EDIT (ERROR)
I changed my username with ...
/Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': 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). (Gem::LoadError)
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/connection_handling.rb:50:in `establish_connection'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/base.rb:26:in `<top (required)>'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:319:in `active_record_configured?'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:251:in `disconnect_database'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:97:in `preload'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:143:in `serve'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:131:in `block in run'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:125:in `loop'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:125:in `run'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
EDIT
I had 3 versions of mysql2 in my system. I removed 0.4.1 and 0.3.20. Now I have only 0.3.18 and after I run bundle install, it is saying "using 0.3.18". Alright, but when I run, generate controller I get this error:
Could not find mysql2-0.4.1 in any of the sources
Run `bundle install` to install missing gems.
So looks like rails is trying to use 0.4.1 even though I told it to use 0.3.18.
If you change your Gemfile to downgrade a particular gem version, following these steps will for-sure work:
Delete the Gemfile.lock file:
rm Gemfile.lock
Generate a new Gemfile.lock using Bundle update:
bundle update
When running the rails s command from my terminal (Mac OSX Yosemite) I'm getting the following error:
Could not find mime-types-2.4.3 in any of the sources
Run `bundle install` to install missing gems.
When I run bundle install I get 'Using mime-types 2.4.3'
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.5
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.1
Using actionview 4.2.0
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.0
Using globalid 0.3.3
Using activejob 4.2.0
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.2.0
Using activemodel 4.2.0
Using arel 6.0.0
Using activerecord 4.2.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using coffee-script-source 1.9.1
Using execjs 2.3.0
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.2.0
Using coffee-rails 4.1.0
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.8
Using jquery-rails 4.0.3
Using bundler 1.7.12
Using tilt 1.4.1
Using sprockets 2.12.3
Using sprockets-rails 2.2.4
Using rails 4.2.0
Using rdoc 4.2.0
Using sass 3.4.12
Using sass-rails 5.0.1
Using sdoc 0.4.1
Using spring 1.3.2
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using uglifier 2.7.0
Using web-console 2.0.0
But running the 'rails s' command again results in the same error message:
Could not find mime-types-2.4.3 in any of the sources
Run `bundle install` to install missing gems.
Here's the gemfile (the default one w my Rails 4.2 created):
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Note - mime-types 2.4.3 is located in the Gemfile.lock
Any ideas as to what the problem might be?
Thank you for your time.
try bundle install --path vendor/cache
Try
bundle update mime-types
then run server again.
Okay,
trying to set up a new rails project, but for some strange reason I'm unable to get my RSpec installed. It keeps throwing the following error:
c700595:retro deh0002a$ bundle exec rails generate rspec:install
Could not find rspec-support-3.0.4 in any of the sources
Run `bundle install` to install missing gems.
This is what my gemfile looks like:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
group :development, :test do
gem 'rspec-rails', '~> 3.0.0'
end
I've run the bundle install command as the error suggests:
c700595:retro deh0002a$ bundle install
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.4.3
Using mail 2.6.1
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using bcrypt 3.1.7
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.6
Using coffee-rails 4.0.1
Using diff-lcs 1.2.5
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.4
Using jquery-rails 3.1.2
Using pg 0.17.1
Using bundler 1.7.4
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.2.0
Using rails 4.1.6
Using rdoc 4.1.2
Using rspec-support 3.0.4
Using rspec-core 3.0.4
Using rspec-expectations 3.0.4
Using rspec-mocks 3.0.4
Using rspec-rails 3.0.2
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Using turbolinks 2.5.1
Using uglifier 2.5.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
So from my bundler output, the missing gem is actually there.
Can someone please tell me what I'm actually missing in this case?
Reinstalled RVM, Rails and everything and now it works.
Guess something destroyed somethin somewhere in regards to paths......