Skip to content
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

undefined method `DelegateClass' for Rack::Session::Cookie:Class (NoMethodError) #98

Closed
tablecell opened this issue Aug 11, 2020 · 3 comments

Comments

@tablecell
Copy link

/Ruby27/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/session/cookie.rb:155:in <class:Cookie>': undefined method DelegateClass' for Rack::Session::Cookie:Class (NoMethodError)
hele_world.rb

require "cuba"
require "cuba/safe"

Cuba.use Rack::Session::Cookie, :secret => "__a_very_long_string__"

Cuba.plugin Cuba::Safe

Cuba.define do
  on get do
    on "hello" do
      res.write "Hello world!"
    end

    on root do
      res.redirect "/hello"
    end
  end
end
@soveran
Copy link
Owner

soveran commented Aug 11, 2020

@tablecell Thanks for reporting this issue. It looks like it's a known bug in Rack: rack/rack#1610

I added a workaround and pushed the version 3.9.3.

@soveran soveran closed this as completed Aug 11, 2020
@tablecell
Copy link
Author

tablecell commented Aug 12, 2020

btw

on "username/:username" do |username|
      user = User.find_by_username(username) # username == "foobar"

Is "User" extends from ApplicationRecord ? Is there any crud example code for database ,such as blog post /list

@soveran
Copy link
Owner

soveran commented Aug 12, 2020

I think it should work just fine with ActiveRecord or any other ORM. Can you give it a try and tell me how it goes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants