When I start server with rails s then I am getting following error.
In your case options is an ActionDispatch::Request::Session::Options object, not a Hash. You can call .to_hash on it to convert it to a Hash.
Instead of your current approach, you could just use slice to pull out the relevant key/values:
REDIS_SET_OPTIONS = %i(ex px nx xx keepttl).freeze
def set (key, value, options = nil)
return super(key, value) unless options
super(key, value, options.to_hash.slice(*REDIS_SET_OPTIONS))
end
.key? by convention would return a boolean. Hence your block is a no-op, as there's nothing being done with the result. What do you want to do?
Although it is really late for this issue, I run into this problem currently. And in my situation, the exception was raised due to the redis-store which was dependent by redis-rails. So when I fixed the version of the redis-rails, the exception was gone. Hope to help if you are still struggling with this issue.
gem 'redis-rails', '~> 4.0.0'