Bundler not updating when it says it has in rails 3.2 - ruby-on-rails-3

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.

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.

undefined method `secret_key=' for Devise:Module (NoMethodError)

I am using devise with Rails 4. I had a problem with some fields not rendering in the user views and I realised it's because of the attr_accessible that's not supported any more so I had a look around and came to the conclusion I should use the latest version of the gem (3.0.3).
And that's when the problem appeared:
I cannot run any rails commands now as I am getting the undefined method 'secret_key=' for Devise:Module (NoMethodError) error and it's not going away even if I downgrade the gem.
Rolling back to some previous git commit doesn't solve it, remove the gem and doing a bundle install again doesn't solve it, and I starting to think I should probably start from scratch.
Does anyone know how to walk past this?
I believe this setting is only available in the more recent versions of Devise, 3.1.x and above. You should either upgrade the gem to this version or remove that line that references secret_key= from your config/initializers/devise.rb file.

Issues with Rails3.0 vs Rails 3.1

So I finally upgraded (and then downgraded because of Unity) Ubuntu and reinstalled RVM but I'b stuck with rails 3.1 now, which is fine but all my old projects are in rails 3.0 and 3.1 has some incompatibilities. Off the top of my head RAILS_ROOT is now Rails.root (which all my projects use in someway), and I was having some issues with heroku when trying to upload a small rails 3.1 app I made to play around (since the PG gem wasnt in my gemlist I couldnt run migrations, and then installing the pg gem caused more issues).
So how do I install rails 3.0 again? I cant seem to find it in the repositories
And I know with gem sets I can install both right? Well if I do that, how do I create a new rails project? Which version of rails would use rails new new_app?
Ok, I understand what you need to do. I would highly recommend making a new Gemset using RVM, that way you can start from scratch and not worry about those things.
To do that, run this in your command line with RVM installed:
// EDIT THIS LINE TO MATCH WHAT YOU WANT
rvm use 1.9.2-or-which-ever-version-you-are-using#temporary_gemset --create
Once this gemset is created, it will be empty, so you can then proceed to install a younger version of rails, like so:
gem install rails -v 3.0.11 // (MAY NEED TO USE SUDO, DEPENDING ON YOUR SET UP)
This should install the older version of rails and its dependencies so that you can still edit and work with your older rails project. Check more of RVM's site for more help on switching between gemsets and creating them.
https://rvm.io//gemsets/
I would still recommend to figure out the differences eventually and move to the newer version for Rails, currently 3.2.5 because they are awesome. Here is some material to show you the differences and new features for when you do that later:
http://railscasts.com/episodes/265-rails-3-1-overview
http://railscasts.com/episodes/282-upgrading-to-rails-3-1
http://railscasts.com/episodes/318-upgrading-to-rails-3-2

Why "bundle update" doesn't update the Gemfile to use Rails 3.0.5?

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.

vestal_versions

I was watching railscasts episode 177, as I need to implement some versioning in my app. But this episode was not done in Rails 3. So i went to the site of the gem itself.
https://github.com/laserlemon/vestal_versions
Now, it says it was tested with Rails 3, but even placing that line in the gemfile didn't let me install it. I just installed using gem install etc.
Now to even generate the migration is an issue, as I get the error
$ rails generate vestal_versions:migration
Could not find generator vestal_versions:migration.
Has anyone managed to succesfully use the gem that could give me advice?
Thanks a lot!
Do you have this line in your Gemfile?
gem 'vestal_versions', :git => 'git://github.com/adamcooper/vestal_versions'
and ran bundle install? That's the one that is in the readme on github and works for me. I had the same error of the missing generator when I used
gem 'vestal_versions'
in my Gemfile, which fetches the gem from rubygems.org, which is pretty old and does not contain the proper generators yet. Using the gem from Github should work.
Btw, I'm not sure which fork on github is the best. There are several that do contain some fixes.