-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems in initalization with Rails 3.0.3, doesn't find ActiveRecord #10
Comments
I have the same problem, but it only occurred after adding the gem 'cells' to my Gemfile. I'm on Rails 3.0.3. |
I'm on Rails 3.0.4 and this happens to me when I have the acts_as_audited 2.0.0.rc7 and default_value_for in my gemfile. Separately, they both work fine. You can easily replicate the problem by making a boilerplate Rails app, making the Gemfile look like https://gist.github.com/edd2f596a5e9ff11b880 , and trying to open the rails Console.
Maxwell:trash john$ |
I think the problem is the presence of rails.rb inside lib. My understanding is that when rubygem loads default_values_for it adds 'default_values_for/lib' to the ruby load path. Then when someone tries to "require 'rails'" they may get 'default_values_for/lib/rails.rb' instead of the expected 'rails/lib/rails.rb' (depending on the order of the load paths). Maybe rails.rb could be moved into a subdirectory? |
I had the same problem and am using the 'cells" gem as well. I've forked and removed the offending file: https://github.com/AndrewO/default_value_for Although it's kind of hacky, I'm kind of reluctant to spend time figuring out how Rails 2 initializes gems since I just don't need it. Still, it makes me a little nervous, but I'm starting to wonder is Cells is doing something funky. Maybe I'll end up looking into it later. |
This should be fixed in commit 999ba35. Can anybody confirm? |
This commit isn't working for me with rails 3.0.5. I'm able to get it to work by manually requiring 'default_value_for/railtie' in my config/application.rb below the Bundler.require line so the railtie seems to be defined correctly. I think what is missing is a 'lib/default_value_for.rb' file that requires 'lib/default_value_for/railtie' when the constant 'Rails::Railtie' is defined. Something like this maybe?
I might even go further and:
I'll test this and submit a pull request. |
I sent a pull request here: #13 |
Thanks, I've merged your pull request. Can anybody else confirm that this works on Rails 3 as well as Rails 2? As soon as I have these two confirmations I will release. |
I'm using 1bc2825 on a Rails 3 project right now. I'm not getting the problem I was having earlier, so I think the Rails 2/3 initialization bug has been sorted out. (I'm having a different problem, but I think it's unrelated or may just be my fault.) |
With 'cells' gem attached in Gemfile this problem still occurs. |
I've confirmed that the problem is fixed. mlitwiniuk, if please open a separate bug report with details if you're still experiencing problems. |
The text was updated successfully, but these errors were encountered: