Jonathan Rochkind
2008-Apr-09 15:02 UTC
updated ''gem''-unintialized constant ActiveRecord??
I would REALLY appreciate help with this. It''s driving me crazy, and
I''ve accidentally messed up my app.
I was working on something that asked me to do a ''gem update
--system''.
So I did. And then it broke my app.
First it was complaining about "require_gem". Okay, I hunted down that
that''s obsolete, and I had to fix my old config/boot.rb to be the new
config/boot.rb that rails today would generate, without obsolete code.
Good enough. I did that, now my app gets further. But still won''t start
up.
Huh, how can it not find ActiveRecord, what the heck?
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:267:in
`load_missing_constant'': uninitialized constant ActiveRecord
(NameError)
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:453:in
`const_missing''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:465:in
`const_missing''
from /usr/local/home/rochkind/U2/config/environment.rb:23
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require''
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in
`require''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:343:in
`new_constants_in''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in
`require''
... 21 levels...
from
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require''
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require''
from ./script/server:3
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
>I was working on something that asked me to do a ''gem update --system''.So I did. And then it broke my app. Why did you need to run the gem command? Which platform are you on? Mac OS X? Some `gem` operations seem to break gem installs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Apr-09 15:10 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
T K wrote:>>I was working on something that asked me to do a ''gem update --system''. > So I did. And then it broke my app. > > Why did you need to run the gem command? > > Which platform are you on? Mac OS X? Some `gem` operations seem to > break gem installs.I am on Linux, Red Hat. I installed the ruby-prof gem, and then put the plugin into a little test app, to test it out. When I tried to start the test app, it told me I needed to update all my gems. So I (stupidly) did. Gem dependency issues are killing me here. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Apr-09 15:37 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
Okay, I kind of sort of figured it out. But I still don''t understand. I have this in my environment.rb: ActiveRecord::Base.allow_concurrency = true [Let''s not get started on whether you can do this with Rails or not. Just trust me, you can if you''re careful. :) ] That used to work fine. After I updated gems, somehow ActiveRecord wasn''t defined yet in environment.rb (missing constant error)? I don''t get it. If I add: require ''active_record'' to the top of my environment.rb, it works again---but I''m worried that manually requiring active_record is going to get around Rails mechanisms of freezing versions and such. But also, I don''t understand why this is neccesary. Why isn''t ActiveRecord yet defined in environment.rb? Huh? Jonathan Rochkind wrote:> T K wrote: >>>I was working on something that asked me to do a ''gem update --system''. >> So I did. And then it broke my app. >>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Apr-09 16:14 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
On 9 Apr 2008, at 16:37, Jonathan Rochkind wrote:> > Okay, I kind of sort of figured it out. But I still don''t understand. > > I have this in my environment.rb: > > ActiveRecord::Base.allow_concurrency = true > > > [Let''s not get started on whether you can do this with Rails or not. > Just trust me, you can if you''re careful. :) ] > > That used to work fine. After I updated gems, somehow ActiveRecord > wasn''t defined yet in environment.rb (missing constant error)? I > don''t > get it. > > If I add: require ''active_record'' to the top of my environment.rb, it > works again---but I''m worried that manually requiring active_record is > going to get around Rails mechanisms of freezing versions and such. > But > also, I don''t understand why this is neccesary. Why isn''t ActiveRecord > yet defined in environment.rb? Huh? >Where in environment.rb do you have that? ActiveRecord is only going to be defined once the initialisation process has loaded ActiveRecord. Any point after the Rails::Initializer.run ... block should be fine. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Apr-09 16:25 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
Frederick Cheung wrote:> On 9 Apr 2008, at 16:37, Jonathan Rochkind wrote: > >> >> yet defined in environment.rb? Huh? >> > Where in environment.rb do you have that? ActiveRecord is only going > to be defined once the initialisation process has loaded ActiveRecord. > Any point after the Rails::Initializer.run ... block should be fine. > > FredThanks. It''s inside the Rails::Initializer.run block. This used to work. For some reason it stopped working when I updated my ''gem'' gem (still using the same version of Rails, 1.2.1). But is this not supposed to be done this way? I find lots of sample code on the web that references ActiveRecord inside the Rails::Initializer.run block? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Apr-09 16:32 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
So this blog post confirms that you can''t access ActiveRecord inside the config block. http://toolmantim.com/article/2006/12/27/environments_and_the_rails_initialisation_process The only mystery to me is why I _used_ to be able to in Rails 1.2.1 before I updated my ''gem'' gem! But okay, I''ll put it in a config.after_initialize instead. For the record, and anyone else google searching on this problem. Very weird, I still don''t understand why this used to work (and why there''s so much code on the web, and I think in the Agile Dev book, that assumes you can reference ActiveRecord in the config block!). Thanks all for the help. Jonathan Jonathan Rochkind wrote:> Frederick Cheung wrote: >> On 9 Apr 2008, at 16:37, Jonathan Rochkind wrote: >> >>> >>> yet defined in environment.rb? Huh? >>> >> Where in environment.rb do you have that? ActiveRecord is only going >> to be defined once the initialisation process has loaded ActiveRecord. >> Any point after the Rails::Initializer.run ... block should be fine. >> >> Fred > > Thanks. > > It''s inside the Rails::Initializer.run block. This used to work. For > some reason it stopped working when I updated my ''gem'' gem (still using > the same version of Rails, 1.2.1). But is this not supposed to be done > this way? I find lots of sample code on the web that references > ActiveRecord inside the Rails::Initializer.run block?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Apr-10 06:58 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
Um.... From what you say, you''ve ripped out your boot.rb file and replaced it, but not replaced the rest of your app! If I were you, from my experience, I''d be rebuilding your app around a new rails generated skeleton. Julian. Learn Ruby on Rails! Check out the FREE VIDS (for a limited time) VIDEO #3 out NOW! http://sensei.zenunit.com/ On 10/04/2008, at 1:37 AM, Jonathan Rochkind wrote:> > Okay, I kind of sort of figured it out. But I still don''t understand. > > I have this in my environment.rb: > > ActiveRecord::Base.allow_concurrency = true > > > [Let''s not get started on whether you can do this with Rails or not. > Just trust me, you can if you''re careful. :) ] > > That used to work fine. After I updated gems, somehow ActiveRecord > wasn''t defined yet in environment.rb (missing constant error)? I > don''t > get it. > > If I add: require ''active_record'' to the top of my environment.rb, it > works again---but I''m worried that manually requiring active_record is > going to get around Rails mechanisms of freezing versions and such. > But > also, I don''t understand why this is neccesary. Why isn''t ActiveRecord > yet defined in environment.rb? Huh? > > Jonathan Rochkind wrote: >> T K wrote: >>>> I was working on something that asked me to do a ''gem update -- >>>> system''. >>> So I did. And then it broke my app. >>> > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Apr-10 14:48 UTC
Re: updated ''gem''-unintialized constant ActiveRecord??
Are there any guides anywhere to doing that? This is a very large app. I am a bit anxious over the idea of "rebuilding my app around a new rails generated skeleton". My issue is that this app was originally built for Rails 1.2.1, but I want to get it working on 1.2.6. It seems as if there were some significant changes to Rails skeleton files between these versions. If I generate a new 1.2.6 app, and then take ALL the skeleton files and pop them into my app, should that work? It''s a lot easier for source control than taking the skeleton and trying to move all my own files into it (I want to go the other way instead). Thanks for any advice. Rails backwards compatibility (or lack thereof) is turning into rather a nightmare for me! Jonathan Julian Leviston wrote:> Um.... > > From what you say, you''ve ripped out your boot.rb file and replaced > it, but not replaced the rest of your app! > > If I were you, from my experience, I''d be rebuilding your app around a > new rails generated skeleton. > > Julian. > > Learn Ruby on Rails! Check out the FREE VIDS (for a limited time) > VIDEO #3 out NOW! > http://sensei.zenunit.com/-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---