Suddenly can't bundle install - ruby-on-rails-4

I haven't changed the versions numbers on any of these since it was working, but suddenly when I run bundle update or bundle install I get:
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 4.0.1) ruby depends on
railties (= 4.0.1) ruby
sass-rails (~> 4.0.0) ruby depends on
railties (4.1.1)
What changed and what gives?

Turns out that sass-rails is will accept railties 4.0.1, rails will not accept railties 4.1.1. The solution was to call out sass-rails with an explicit version number at the beggining of the Gemfile.
Before:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
After:
source 'https://rubygems.org'
gem 'railties', '4.0.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

Related

Could not find generator 'mongoid:config'. When rails generate mongoid:config

I'm new to Ruby on Rails.I've been trying generate mongoid.yml file to connect with mongodb. but im getting this error:
`Could not find generator 'mongoid:config'.
Did you mean? mongoid:devise
Run `bin/rails generate --help` for more options.`
This is my Gemfile
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.3"
gem 'mongoid'
gem 'jquery-rails'
gem 'devise'
gem 'figaro'
gem 'haml-rails'
gem 'haml'
gem "bson"
gem "moped", github: "mongoid/moped"`
gem 'nokogiri'
gem 'kaminari'
gem 'rack-contrib'
gem 'soulmate', require: 'soulmate/server'
gem 'carrierwave'
gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
gem 'colorize'
gem 'typhoeus'
gem 'execjs'
gem 'roo'
gem 'addressable', require: 'addressable/uri'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem "passenger",require: "phusion_passenger/rack_handler"
I tried adding these to Gemfile. But not working.
gem 'activemodel-serializers-xml', github: 'rails/activemodel-serializers-xml' gem "active_model_serializers", require: true gem 'activemodel-serializers-xml' gem 'active_model_serializers'
I have noticed gem moped is kind of old for this version of mongoid. Please help if anyone
Thank you in advance!
moped is an out of date (legacy) version of the MongoDB Ruby Driver.
When you add the mongoid gem to your Gemfile, it will automatically pull in the version of the driver (mongo) that matches the dependency in the gemspec (ex: https://github.com/mongodb/mongoid/blob/v8.0.3/mongoid.gemspec#L41).
Removing moped from your Gemfile and re-running bundle install should do the trick ;)

How to install activerecord-sqlserver-adapter (~> 4.0.0)?

I have a Rails 4 project and use activerecord-sqlserver-adapter. The readme installation suggests:
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter', '~> 4.0.0'
However, bundle install returns:
Resolving dependencies...
Could not find gem 'activerecord-sqlserver-adapter (~> 4.0.0) ruby' in the gems available on this machine.
rubygems.org show the latest version as 3.2.12. How can I bundle install version ~> 4.0.0 as 3.2.12 only supports ActiveRecord 3.x?
Why not just Source version 4.0.0 of activerecord-sqlserver-adapter directly from Github.
In Gemfile
Replace
gem 'activerecord-sqlserver-adapter', '~> 4.0.0'
With
gem 'activerecord-sqlserver-adapter', '~> 4.0.0', :git => "git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git"
They have not provided support for Rails 4 yet, you can try below gem to obtain same thing.
sudo gem install sic-activerecord-sqlserver-adapter
This will work with Rails 4 definitely, i have tried this. thanks.
It says that the adapter is missing.
You should install ruby-odbc and it should work.
gem 'ruby-odbc', '0.99995'

Rails 4: activeadmin error message - Bundler could not find compatible versions for gem "actionpack"

I want to use activeadmin for my rails project, so I added it to my gemfile.
gem 'activeadmin'
and updated the bundle, but received this error message -
Resolving dependencies...
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
activeadmin (>= 0) ruby depends on
actionpack (~> 3.0.0.rc2) ruby
rails (= 4.0.0) ruby depends on
actionpack (4.0.0)
I uploaded the project in github; this is the link of the gemfile - https://github.com/Mashpy/esl/blob/master/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'
#gem
gem 'activeadmin'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
What am I doing wrong that is preventing me from adding activeadmin?
Active Admin has a few other dependencies as well. Check this out Active Admin install with Rails 4.
Copy and paste all the gems (in the top answer) to your gemfile and you should not have any issues running bundle.
You can update your bundle using -
bundle update
Then
bundle install
To make sure your configuration of the gems are right.
I think you should upgrade these gems :
sass-rails ~> 3.2.3
coffee-rails ~> 3.2.1
References:
http://guides.rubyonrails.org/3_2_release_notes.html

delayed_job gem won't start in production (Rails 4)

I'm having a problem with getting delayed_job to start in the production environment. Everything works as it should in development just using the rake jobs:work command, but after deploying to my server with Capistrano, and hours of failed attempts later, I cannot figure out how to get DJ running.
As it says to do on the github repository for delayed_job, I made sure I bundled the "daemons" gem, and also attempted to start it with the command "bin/delayed_job start" instead of "script/delayed_job start" since I'm on rails 4. I've also ran the required generator "rails generate delayed_job" which did generate this file inside the bin directory of my project:
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize
The error I'm consistently getting is -bash: bin/delayed_job: No such file or directory which I think could be since I'm using rvm.
As for my gemfile, I've included delayed_job_active_record and daemons. At this point I'm completely stumped and out of links to explore.
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
# Rails defaults
gem 'sass-rails', '~> 4.0.0'
gem 'bundler'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
# learn-rails
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails', :github => 'anjlab/bootstrap-rails'
gem 'figaro'
gem 'gibbon'
gem 'high_voltage'
gem 'simple_form', '>= 3.0.0.rc'
gem 'delayed_job_active_record', '~> 4.0.0'
group :development, :test do
gem 'sqlite3'
gem 'better_errors'
gem 'quiet_assets'
gem 'capistrano', '~> 2.15.5'
gem 'rvm-capistrano'
gem 'rspec-rails'
end
group :test do
gem "factory_girl_rails", "~> 4.0"
gem 'capybara'
gem 'poltergeist'
gem "faker", "~> 1.2.0"
end
group :production do
gem 'unicorn'
gem 'pg'
gem 'daemons'
end
Make sure the first line in bin/delayed_job points to a valid Ruby executable. You're using just ruby which probably can't be resolved. rvm is adding the full path to ruby when you cd into the rails_root directory, but that's not happening when the script is executed. One slightly hacky solution would be to cd into the directory, do a which ruby and write that into bin/delayed_job, such as: #!<path_to_ruby>. No need to call /usr/bin/env since Capistrano is doing this already.

gem globalize3 on rails 4

Someon are using globalize3 with rails4.
How you configure it?
i tryed to install, on my Gemfile:
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
but i have these errors:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
globalize3 (>= 0) ruby depends on
railties (~> 3.0) ruby
coffee-rails (~> 4.0.0) ruby depends on
railties (4.0.0)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
globalize3 (>= 0) ruby depends on
rails (~> 3) ruby
rails (4.0.0)
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
rails (= 4.0.0) ruby depends on
actionpack (= 4.0.0) ruby
simple_form (~> 3.0.0.rc) ruby depends on
actionpack (4.0.0.rc1)
The globalize3 gem has been renamed globalize and major version numbers now correspond to the corresponding version of ActiveRecord (3.x for AR3 and 4.x for AR4).
So all you need to do is put this in your Gemfile, and you should not get any conflict:
gem 'globalize', '~> 4.0.0.alpha.2'
See also the github repository for more details.
Try this use these 2 lines at your Gemfile:
gem 'paper_trail', github: 'airblade/paper_trail', branch: 'rails4'
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4', ref: 'ffb5c771b9'
Use this. Paper_trail merged rails4 into master branch.
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
gem 'paper_trail', github: 'airblade/paper_trail', branch: 'master'
This worked for me:
gem 'globalize', '~> 4.0.2'
Please check on the latest instructions here:
https://github.com/globalize/globalize#installation