steveklabnik / request_store

Per-request global storage for Rack.
https://github.com/steveklabnik/request_store
MIT License
1.48k stars 87 forks source link

rails 5.0.0.alpha #46

Closed msroot closed 8 years ago

msroot commented 9 years ago

I am trying RequestStore with rails 5 and it seems it doent work

>> RequestStore.store[:foo] = :bar
=> :bar
>>  RequestStore.store[:foo]
=> nil
>>
msroot commented 9 years ago

Ok the problem it happens when i run rails in development and as i see here https://github.com/steveklabnik/request_store/blob/master/lib/request_store/railtie.rb#L12 is cleaning ActionDispatch.const_defined?(:Reloader)

But it would be nice if i can explicitly say if i want to clean


if ActionDispatch.const_defined?(:Reloader) && 
ActionDispatch::Reloader.respond_to?(:to_cleanup) && 
!RequestStore.skip_cleanup
        ActionDispatch::Reloader.to_cleanup do
          RequestStore.clear!
        end
      end
steveklabnik commented 9 years ago

It should only clean when you call reload!, i thought.

u007 commented 8 years ago

any updates on this issue?

steveklabnik commented 8 years ago

I haven't used rails 5, so I don't know what's going on.

u007 commented 8 years ago

this is related? W, [2016-03-08T03:04:44.800053 #11389] WARN -- : DEPRECATION WARNING: to_cleanup is deprecated and will be removed from Rails 5.1 (use ActiveSupport::Reloader.to_complete instead). (called from block in class:Railtie at /usr/local/rvm/gems/ruby-2.2.4/bundler/gems/request_store-7993a21200ac/lib/request_store/railtie.rb:11)

steveklabnik commented 8 years ago

Yes, that sounds like it. I would be happy to take a patch to fix this; I'm not sure I'll have time to look until next week.

steveklabnik commented 8 years ago

1.3.1 should have fixed this, give it a try!

msroot commented 8 years ago

@steveklabnik thanks :)