Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

shouldn't call method be to an app instance instead of the app class? #3

Closed
lyleunderwood opened this Issue · 5 comments

2 participants

@lyleunderwood

https://github.com/csquared/rack-worker/blob/master/lib/rack/worker.rb#L95

I'm getting undefined method `call' because the next piece in the middleware chain has an instance method "call" but no class method "call". I'm confused about how this is supposed to work.

@lyleunderwood

I would love to see rack-worker functioning, but I cannot get it to do so. Part of its process is to serialize env to json, and obviously objects like rack.input (part of the rack spec) are no longer functional. The env just can't be serialized and unserialized in a valid enough way for other basic middleware or something like rails to work with this. I don't see how it ever functioned. Am I confused?

@csquared
Owner

Hey lyle:
I've been using this with Sinatra apps and straight Rack apps (look at the tests) and havent' used this middleware in a Rails app just yet. I was hoping that because Rails 3 is "rack compliant" it should have been able to just drop in.

You can ignore rack.input for GET requests (its for POST bodys).

@csquared
Owner

i think you're right about this -- that line should look like:

status, headers, body = app.new.call(env.merge('rack.worker_qc' => true))

no?

@csquared
Owner

right now having some trouble running the tests again, but will release as soon as i have it tested

@csquared
Owner

if you look at the Rack docs, they say you should define ::call at the class level

https://github.com/rack/rack/blob/master/lib/rack/builder.rb#L93

but i think the about.com docs places show it as an instance method
http://ruby.about.com/od/rack/a/Using-Rack.htm

this supports both:
57d556c

looking to release this soon

@csquared csquared closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.