This project is archived and is in readonly mode.
session_store initializer causes rake:gems tasks to break
-
Michael Klett
- Tag set to cookiestore, gems
I'm running in to this too. Would it be good enough to abort the CookieStore initialization if
@@@ruby $rails_rake_task = true
I see this done elsewhere in the intializer.rb code, but I'm not sure where the CookieStore gets initialized, or what other implications this would have. I would think that you would not need access to the session for most rake tasks. -
Adam McCrea
- Tag changed from cookiestore, gems to cookiestore, gems, patch
Here is a patch to make it work, but I have no idea how to unit test it. To recreate the bug in an application:
- add a gem dependency for a gem that you do not have installed
- run rake:gems
-
Adam McCrea
Bah! My diff contained some unnecessary junk. Here is the corrected patch.
-
DHH
- Assigned user set to josh
- Milestone cleared.
-
josh
- Assigned user changed from josh to Rick
-
dstrelau
Just a +1 to say that I'm running into this too.
-
iain
+1 for this one.
Besides the point:
This issue gets in the way of Rails Templates. Templates would be a good way to add a certain functionality to your project, which requires multiple steps, but by making a template, it should just work!
@@@ruby
install cucumber template
gem 'cucumber' rake "gems:install", :sudo => true generate :cucumber
(templates should be available to install.rb of plugins too, but that's another issue) -
Matt Jones
As noted on other tickets: running initializers when gems aren't present is DOING IT WRONG. While it fixes this single case, it will make most situations fail dramatically.
For instance, when using the Settings gem (app-wide settings, stored in the DB), one typically uses an intializer to set default values:
# in config/initializers/default_settings.rb Settings.default[:foo] = "bar"Loading this initializer without the gem is bad, bad, bad. The real solution is going to require that config.gem (or equivalent) move out of environment.rb into something loaded earlier; it's not good that the gems: Rake tasks depend on the environment.
I've attached a patch that breaks out of the initializer entirely if gems are missing in the gems rake tasks. This should solve both this bug and the problem where loading, for example, ApplicationController required missing gems.
No idea how to write a "test" for this, but the behavior is pretty clear from the code...
-
austinfromboston
+1 matt jones' patch works -- we vendored rails and apply the patch in our template and all goes swimmingly.
-
josh
- Assigned user changed from Rick to josh
- State changed from new to open
-
Repository
- State changed from open to resolved
(from [01c818e99f04f70462df68e6a217dfd280c37581]) break out of initializer early if gems aren't loaded [#1750 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
-
Thijs
This now seems to break if you have your session config defined in environment.rb the old way. Took me an hour :-). Would that be considered a bug? Maybe this should be included in the docs?
-
josh
@Thijs can you retest on edge rails. If its still a problem please open a new ticket. config.action_controller.session_options = should still work
