Solved

Active record already activated

Posted on 2009-05-03
23
854 Views
Last Modified: 2013-11-13
I am using MediaTemple rails hosting and when I am trying to run my application I get this from my mongrel log:

** Daemonized, any open files are closed.  Look at log/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:2013
** Starting Rails with production environment...
/home/66747/data/rubygems/lib/rubygems.rb:149:in `activate': can't activate activerecord (= 2.3.2, runtime), already activated activerecord-2.1.0 (Gem::Exception)
      from /home/66747/data/rubygems/lib/rubygems/custom_require.rb:35:in `require'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:222:in `require_frameworks'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:222:in `each'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:222:in `require_frameworks'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:113:in `process'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:93:in `send'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:93:in `run'
      from /home/66747/containers/rails/bestqualitypools/config/environment.rb:14
       ... 11 levels...
      from /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
      from /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
      from /home/66747/data/rubygems/gems/bin/mongrel_rails:19:in `load'
      from /home/66747/data/rubygems/gems/bin/mongrel_rails:19


I have tried running "gem cleanup" and when I type in "gem list" I get:

*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
fastthread (1.0.1)
gem_plugin (0.2.3)
mongrel (1.1.5)
mysql (2.7)
postgres (0.7.9.2008.01.28)
rails (2.3.2)
rake (0.8.4)
rmagick (1.15.15)
validatable (1.6.7)

Any ideas on what I can do? My database config looks like:

production:
  adapter: mysql
  database: db66747_bestqualitypools_production
  username: db66747_pools
  password: pw_here
  host: internal-db.s66747.gridserver.com

The username does have read/write permissions and the database is completed.

Not sure what else to do, i have googled the problem and checked on various google groups.

Thanks,

Ryan
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 9
23 Comments
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292401
Do you have any gems unpacked in your application?  Maybe you unpacked 2.1 into vendor/gems and have 2.3.2 required?

Do you have AR specified twice in your environment.rb file?  Check out the lines with "config.gem".
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292411
>>Do you have any gems unpacked in your application?  Maybe you unpacked 2.1 into vendor/gems and have 2.3.2 required?

How would I check this? I am fairly new with Ruby on Rails.

Here is my environment.rb: http://pastie.org/467269

Thanks,

Ryan

0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292425
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION

This says "use version 2.1.2" but your gem list doesn't show that 2.1.2 is installed.

Either:
* (sudo) gem install rails -v 2.1.2
* Change the RAILS_GEM_VERSION to be 2.3.2

The first is safer, because you don't know if your application will work on the new version without some tweaking.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292437
Now that is is going to go through and install that version do I need to go through and remove my other versions of active record?
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292445
No.  Rails will use the one specified in the file.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292467
Alrighty, now when I try to start my application I get:

** Daemonized, any open files are closed.  Look at log/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:2013
** Starting Rails with production environment...
/home/66747/data/rubygems/lib/rubygems.rb:149:in `activate': can't activate activerecord (= 2.1.2, runtime), already activated activerecord-2.1.0 (Gem::Exception)
      from /home/66747/data/rubygems/lib/rubygems/custom_require.rb:35:in `require'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:222:in `require_frameworks'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:222:in `each'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:222:in `require_frameworks'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:113:in `process'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:93:in `send'
      from /home/66747/containers/rails/bestqualitypools/config/../vendor/rails/railties/lib/initializer.rb:93:in `run'
      from /home/66747/containers/rails/bestqualitypools/config/environment.rb:14
       ... 11 levels...
      from /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
      from /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
      from /home/66747/data/rubygems/gems/bin/mongrel_rails:19:in `load'
      from /home/66747/data/rubygems/gems/bin/mongrel_rails:19

And my gem list is now:

actionmailer (2.1.2)
actionpack (2.1.2)
activerecord (2.1.2)
activeresource (2.1.2)
activesupport (2.1.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
fastthread (1.0.1)
gem_plugin (0.2.3)
mongrel (1.1.5)
mysql (2.7)
postgres (0.7.9.2008.01.28)
rails (2.3.2, 2.1.2)
rake (0.8.4)
rmagick (1.15.15)
validatable (1.6.7)

And in my environment:

RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION


0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292487
Do you have a folder "rails" in your "vendor" directory?  

If so, you can try removing it.

If not, you can unpack rails with:
rake rails:freeze:gems

That'll unpack it into the vendor/rails directory so that you KNOW what version is running.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292493
I tried deleting it via FTP, but it got caught up on deleting the folder "Argentina" I will try using the code.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292501
When I run:

"rake rails:freeze:gems"

I get:

"rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/home/66747/data/rubygems/gems/gems/rake-0.8.4/lib/rake.rb:2353:in `raw_load_rakefile'
(See full trace by running task with --trace)
"

There is "Rakefile" inside application directory in the root.
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292502
Yeah, FTP would be slow.
SSH would be better if that's an option.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292507
Inside my vendor/rails directory I have:

activesupport/
railties/

It gets hung up like I said on the Argentia folder within activesupport/ - language folder maybe?
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292513
I am SSH in to the server now. How would I run an FTP to delete? I can check the MT control panel for that.

Ryan
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292524
Just nuke the whole vendor/rails folder:
rm -rf vendor/rails/

... from the application's base directory.

Then, try the rake freeze command, again from the application's base directory.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292541
Nice! That worked, now running, the rake freeze (what does this do by the way?)

I get:

Freezing to the gems for Rails 2.3.2
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
ERROR:  Gem 'activesupport' not installed.
mv  activesupport
rm -rf vendor/rails
rake aborted!
undefined method `to_str' for nil:NilClass

(See full trace by running task with --trace)

Should I run gem install activesupport?
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292549
Freezing takes the gems and unpacks them to the vendor/rails directory so that the application is frozen ("locked") to running that version.  You wouldn't need the gems installed on a machine that way.

Huh.  Your gem list --local from above shows activesupport.

Check it again:
gem list --local

Do you see:
  activesupport (2.1.2)

If you run the 'gem install' you'll get the latest version, not 2.1.2, fyi.

0
 
LVL 14

Accepted Solution

by:
wesgarrison earned 500 total points
ID: 24292553
Try this to force using 2.1.2:

rake rails:freeze:edge RELEASE=2.1.2
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292562
When I run that command I get:

activesupport (2.1.2)

I do have that installed, not sure why that is not running.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292576
Well then...aren't you just the ror guru ;)

I ran that and I got:

bestqualitypools.info@n11:/home/66747/containers/rails/bestqualitypools$ rake rails:freeze:edge RELEASE=2.1.2
(in /nfs/c04/h04/mnt/66747/containers/rails/bestqualitypools)
cd vendor
Downloading Rails from http://dev.rubyonrails.org/archives/rails_2.1.2.zip
Unpacking Rails
rm -rf rails
rm -f rails.zip
rm -f rails/Rakefile
rm -f rails/cleanlogs.sh
rm -f rails/pushgems.rb
rm -f rails/release.rb
cd -
Updating current scripts, javascripts, and configuration settings
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292578
Let me try starting my application and see what my log reports.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292584
Amazing..that worked like a charm!

So it was the activerecord causing the problem?
0
 
LVL 1

Author Closing Comment

by:catonthecouchproductions
ID: 31577429
Great help! Very quick
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 24292590
Dunno.  Maybe your vendor/rails was incomplete so it couldn't find activesupport.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24292594
Yeah..I wonder what it was. Specifying the rake command worked great.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Is Ruby On Rails relevant 3 521
Ruby on Rails/Postgres --- Looks to be a query issue? 7 714
Merge XML files using a unique key? 8 144
is this a cms? 8 92
Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question