Skip to content

"undefined method cookies" when using Force for User in Dashboard #480

Description

@joffotron

Ruby 2.3.3 / Rails 5.0.1

initializers/split.rb:

Split.configure do |config|
  config.enabled = true
  config.persistence = :cookie
  config.include_rails_helper = true
  config.redis = ENV['REDIS_URL'] || "redis://redis:6379"
end

Clicking on "Force for current user" results in:

2017-03-27 01:27:26 - NoMethodError - undefined method `cookies' for #<Split::Dashboard:0x007f5f1015a9e8>:
 	/bundle/gems/split-2.2.0/lib/split/persistence/cookie_adapter.rb:9:in `initialize'
 	/bundle/gems/split-2.2.0/lib/split/user.rb:8:in `new'
 	/bundle/gems/split-2.2.0/lib/split/user.rb:8:in `initialize'
 	/bundle/gems/split-2.2.0/lib/split/dashboard.rb:34:in `new'
 	/bundle/gems/split-2.2.0/lib/split/dashboard.rb:34:in `block in <class:Dashboard>'
 	/bundle/gems/sinatra-2.0.0.beta2/lib/sinatra/base.rb:1643:in `call'

If I configure persistence using the SessionAdapter, it works as I would expect.

Is this a Bug? A Misconfiguration?

Activity

  1. andrew commented on Mar 27, 2017

    @andrew
    Member

    Looks like a bug to me

  2. jgoulah commented on Mar 30, 2017

    @jgoulah

    we're also seeing this (rails 4.2.1, ruby 2.2.5p319)

  3. andrehjr commented on Jun 4, 2017

    @andrehjr
    Member

    Hey @andrew, to fix this on Sinatra/Rails I think we need to change the implementation of the CookieAdapter to use Rack directly(same way Sinatra::Cookies does), that way it should work for both Rails/Sinatra or any Rack app.

    I made a simple test, and that works. Want me to take a stab on this and submit a PR?

  4. andrew commented on Jun 4, 2017

    @andrew
    Member

    That'd be great thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions