rake precompile:assets throwing error

68 views
Skip to first unread message

sith

unread,
May 14, 2013, 3:07:06 AM5/14/13
to rubyonra...@googlegroups.com
While running rake precompile:assets i'm getting the following error

This is the error message:
rake assets:precompile:all RAILS_ENV=production
rake aborted!
undefined local variable or method `establish_connection' for ActiveRecord::Base:Class



Please help

mike

unread,
May 15, 2013, 9:21:41 AM5/15/13
to rubyonra...@googlegroups.com
not sure on this, it could be a number of things.  establish_connection is a class method used by Active Record to establish a connection between your application and the database, using the information you provide in config/database.yml.   By default, it's called whenever rails is invoked, even though it really has nothing to do with precompiling assets.  Usually, when it throws an error, there's an error somewhere in the database.yml file, but this error almost looks like it's missing the definition for the ActiveRecord class.  

It's going to be hard to pinpoint this error without more information.  What version of rails are you running and in your config/application.rb file do you have the line require 'rails/all' ?

Colin Law

unread,
May 15, 2013, 10:05:31 AM5/15/13
to rubyonra...@googlegroups.com
Do you get the same error when you start the server or run rake
db:migrate for example?

Colin

sith

unread,
May 15, 2013, 11:55:27 PM5/15/13
to rubyonra...@googlegroups.com
I solved this by specifying the version of my gem 'newrelic_rpm' .I still can't figure out why I had to do so to solve my issue.

Remya s.

unread,
Jun 24, 2013, 2:33:37 AM6/24/13
to rubyonra...@googlegroups.com
sith wrote in post #1109140:
> I solved this by specifying the version of my gem 'newrelic_rpm' .I
> still
> can't figure out why I had to do so to solve my issue.



Thanks, this worked for me by giving this line in gemfile -

'gem 'newrelic_rpm' , "3.5.4.33"'

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages