Why "bundle update" doesn't update the Gemfile to use Rails 3.0.5? - ruby-on-rails-3

I tried using bundle update for a Rails 3.0.0 project I created, expecting all the content in Gemfile (and also Gemfile.lock) to reflect rails 3.0.5...
But it keep on being 3.0.0... even if I run bundle update rails, it still keep on being 3.0.0
Out of curiosity, I created a brand new Rails 3.0.0 project, and then run bundle update on it... and it still says "using rails 3.0.0", why? And how to make bundle update update to 3.0.5? (other than the obvious way to change the Gemfile by hand)
(I even tried changing sqlite3-ruby to sqlite3 in the Gemfile, because 3.0.5 seems to use sqlite3 instead. And rails and sqlite3 are the only 2 gems listed in Gemfile)

You already had the answer: change the gem version by hand and run bundle update rails.
I suspect you have gem 'rails', '3.0.0' in your Gemfile. Running bundle update rails won't change the version if you have the exact version specified.
Here's some info about the different ways of specifying gem versions in your Gemfile.
http://gembundler.com/rationale.html

Yeah you probably have
gem 'rails', '3.0.0'
change it to
gem 'rails', '~>3.0.0'
This will only upgrade minor versions of rails(3.0.5 & 3.0.6 ...). Or you can change it to
gem 'rails', '~>3.0'
if you want to upgrade to rails 3.1 but not 4.0

This is one of the top result when searching for "bundler wont update" on Google so I'm adding following as another answer. I was facing this issue in one of my projects.
In one of my projects I had a .bundle/config file which had following line:
BUNDLE_FROZEN: "1"
This was causing bundle update <gemname> to have no effect. I removed above line and it started updating again.

Related

I installed middleman, but I still have v3.4.1 and not v4 as expected

I don't know if I am thinking right, but I couldn't find anything on the web regarding the installation of middleman v4.
I did the installation as explained on Middleman website : https://middlemanapp.com/basics/install/
And my Gemfile in my middleman folder is still showing
gem "middleman", "~>3.4.1"
Am I doing something wrong ?
The problem is that the ~> designation is preventing your app from installing any version of the Middleman gem that is higher that 3.5. Try changing that line to something like this:
gem "middleman", "~> 4.2"
After updating your Gemfile, you'll need to run bundle update middleman to update the Middleman gem.

Bundler not updating when it says it has in rails 3.2

I am using the best_in_place gem. Unfortunately, the update code on the gem was not working properly but a solution had been found and merged into the latest alpha version of the gem. Initially I simply edited the gemfile and added the fix but I know that is bad practice so I added:
gem 'best_in_place', github: 'bernat/best_in_place'
to get the latest version. I bundle installed and it said this:
Using best_in_place (3.0.0.alpha) from git://github.com/bernat/best_in_place.git (at master)
But, when I go and look at the actual file it has not been changed.
Run bundle update best_in_place to update to the latest commit.

undefined local variable or method `config' for main:Object (NameError) when running rails server

Hi I've been following a tutorial for authlogic gem in railscasts... http://railscasts.com/episodes/160-authlogic?view=asciicast
From the tutorial, I was asked to add config.gem "authlogic" in my environment.rb
Is it the old way in installing a gem? or the right way to make authlogic work?
I removed the config.gem "authlogic" and tried to install the gem using gem install authlogic and by putting gem 'authlogic' inside my Gemfile (then bundle it)
Authlogic gives automatic form validation (when there's no input or what)
But it is not working. It could be possibly that I didn't install the authlogic gem properly?
What do you think is the problem why my Authlogic gem is not working..
Given the age of the Railscast, it's a good bet that the installation procedure is outdated. Luckily, the authlogic github page has not only updated install instructions (it is, as you'd expect and predicted, adding gem 'authlogic' to your Gemfile), it also has links to assorted tutorials and documentation. Hopefully you can use those to sort out your issue.

Should I pin gem "rails" to a version?

Most rails projects have a very specific version included in their gemfile, right after a rails new foo.
For example gem 'rails', '3.1.3'
Would it not be better to change this to allow dot-version and e.g. define rails as gem 'rails', '~>3.2'?
How is rails version-numbering done? I see major changes between dot-releases, e.g. upgrading from 3.0 to 3.1 requires quite severe changes (mostly to the asset pipeline). How is that for subreleases? Is 3.2.1 a bugfixonly release of 3.2.0?
There's not really any reason not to use the ~> constraint, but you should put:
gem 'rails', '~>3.1.3'
since that will mean any 3.1.x that is at least 3.1.3. Putting ~>3.1 implies compatibility with any Rails version 3.x.
Rails versioning follows semantic versioning, as far as I know.
However, I think the idea of specifying the exact version is that you read the release notes with every release and make a specific effort to validate that it's okay. Ultimately it's all up to you, though. You should be sure you're somehow following a feed for Rails versions so you always know about security releases either way.

Attaching refinery cms to existing rails app version 3.1.1

I have an existing Rails app of version 3.1.1 and I am planning to add refinery cms to it. I have tried googling about it and have found few solutions.
I have placed following line in the gemfile:
gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git'
On bundle install it is exiting in between giving the following output.
Bundler could not find compatible versions for gem "rails": In
Gemfile:
refinerycms depends on
rails (>= 3.1.3)
rails (3.1.1)
This is telling you that refinery needs at least version 3.1.3, while you're using 3.1.1. The changes between these two point releases are likely small enough that it should be a painless upgrade process.
Check whether you have rails version 3.1.1 specifically specified in your Gemfile and if so change it to gem "rails", "3.1.3".
Run bundle update rails