Will paginate is missing on rake db:migrate

I have a very annoying problem, when doing rake db:migrate, I get the
error message:

Missing these required gems:
  will_paginate ~> 2.3.11

But the gem is not missing, It runs very well in my app. To make the
rake pass I have to comment out the gem in my environment.rb file.

environment.rb:
config.gem "will_paginate", :version => "~> 2.3.11", :source =>
"http://gemcutter.org"

I use snow leopard. What have I done wrong?

Jonas-MB:stuteri jeb$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
authlogic (2.1.3)
nifty-generators (0.3.0)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
searchlogic (2.3.9)
sqlite3-ruby (1.2.5)
tabs_on_rails (1.0.0)
will_paginate (2.3.11)

Jonas-MB:stuteri jeb$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
  - INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /opt/local/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /opt/local/lib/ruby/gems/1.8
     - /Users/jeb/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
Jonas-MB:stuteri jeb$

Maybe rake gems

sudo rake gems:install

config.gem "will_paginate", :version => "~> 2.3.11", :source =>
"http://gemcutter.org"

My configuration is including ":lib => 'will_paginate'", so try like
this,
config.gem "will_paginate", :version => "~> 2.3.11", :lib =>
'will_paginate', :source => "http://gemcutter.org"

It must be specified in here,
Rails::Initializer.run do |config|
config.gem "will_paginate", :version => "~> 2.3.11", :lib =>
'will_paginate', :source => "http://gemcutter.org"
end

Thanks, but the problem remains.

Nope, the same problem...

I have a very annoying problem, when doing rake db:migrate, I get the
error message:

Missing these required gems:
will_paginate ~> 2.3.11

But the gem is not missing, It runs very well in my app. To make the
rake pass I have to comment out the gem in my environment.rb file.

Is it possible that rake is from one install of ruby and but that when
you run your app a different install is used ? (compare the output of
which ruby and which rake)

Fred

How about change version to '~> 2.3', actually mine is '~> 2.3.2' and
mislav-will_paginate (2.3.11)

Hmm... That may be something...

The output looks like:

Jonas-MB:stuteri jeb$ which ruby
/opt/local/bin/ruby
Jonas-MB:stuteri jeb$ which rake
/usr/bin/rake

Is that not as is should? Everything else works fine...

Did you I intall rake because it should be intalled in the same place as Ruby executable?

-Conrad

You may just need to edit the #! line at the top of /usr/bin/rake to reference /opt/local/bin/ruby instead of whatever it has now.

-Rob

Hmm... That may be something...

The output looks like:

Jonas-MB:stuteri jeb$ which ruby
/opt/local/bin/ruby
Jonas-MB:stuteri jeb$ which rake
/usr/bin/rake

Is that not as is should? Everything else works fine...

That means you have two installs of ruby, one which has your gems
installed, one which doesn't. Does /opt/local/bin/rake exist ? if not,
install it (be careful that you may have the same problem with the gem
command - check what which gem says)

Fred

I guess this happened when I upgraded to snow leopard. My .profile
file was last modified under 10.5. It looks like:

# MacPorts Installer addition on 2009-02-11_at_21:01:31: adding an
appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with
MacPorts.

Is that the problem?

What is the easiest way to clean this mess up?

I guess this happened when I upgraded to snow leopard. My .profile

file was last modified under 10.5. It looks like:

MacPorts Installer addition on 2009-02-11_at_21:01:31: adding an

appropriate PATH variable for use with MacPorts.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Finished adapting your PATH environment variable for use with

MacPorts.

Is that the problem?

What is the easiest way to clean this mess up?

The quickest is to install the correct gems for the right ruby. For example,

rake, ruby, and gem should exist in /opt/local/bin. If not, then you’ll need

to install the appropriate ports.

-Conrad

I guess this happened when I upgraded to snow leopard. My .profile
file was last modified under 10.5. It looks like:

# MacPorts Installer addition on 2009-02-11_at_21:01:31: adding an
appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with
MacPorts.

Is that the problem?

What is the easiest way to clean this mess up?

It depends whether you want the macports install of ruby or whether
you'd rather keep the non macports one (if you don't care about the
macports one then you should be able to get macports to remove it. If
you do want it, the easiest thing might be to force macports to
reinstall it or something like that)

Fred

I guess this happened when I upgraded to snow leopard. My .profile

file was last modified under 10.5. It looks like:

MacPorts Installer addition on 2009-02-11_at_21:01:31: adding an

appropriate PATH variable for use with MacPorts.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Finished adapting your PATH environment variable for use with

MacPorts.

Is that the problem?

What is the easiest way to clean this mess up?

The quickest is to install the correct gems for the right ruby. For example,

rake, ruby, and gem should exist in /opt/local/bin. If not, then you’ll need

to install the appropriate ports.

If you are wanting to continue with MacPorts, then I would recommend doing

the following if you have done so on Snow Leopard:

$ sudo port selfupdate

$ sudo port sync

$ sudo port upgrade --force installed

If you’re not wanting to continue with MacPorts, then I would recommend doing

the following:

$ sudo port deactivate ruby

Now, rake, gem, and ruby should exist in the following location:

/usr/bin

Now, I would recommend doing the following:

$ sudo gem update --system

$ sudo gem install gemcutter

$ gem tumble

$ sudo gem install rake rails will_paginate

Good luck,

-Conrad

I've had this problem before on Leopard. The only way that I've been
able to get rid of that warning was to remove :version from the
options hash. So this:

config.gem "will_paginate", :version => "~> 2.3.11", :source =>
"http://gemcutter.org"

Becomes this:

config.gem "will_paginate", :source => "http://gemcutter.org"

I realize that this is not a true solution, but the gem version isn't
required unless you think you may be using a different version in your
production environment. But, technically speaking, you should have a
mirrored environment for your development and production machines
anyway.

It is a strange error that I've mentioned on here before. Try the
method above and see if that helps.

Great!

After doing the what you said with MacPorts, and then uninstalling and
installing will_paginate it works!

Thanks alot!