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

"proc without block" problems with sinatra and padrino #14

Closed
pzingg opened this issue Feb 1, 2010 · 4 comments
Closed

"proc without block" problems with sinatra and padrino #14

pzingg opened this issue Feb 1, 2010 · 4 comments

Comments

@pzingg
Copy link

pzingg commented Feb 1, 2010

Apparently because sinatra's application class (and/or padrino's router class) magically mixes in methods with common names like 'set' and 'delete', it causes all kinds of problems. What happens is that the method_missing method in redis.rb ends up delegating redis commands to sinatra!

I added explicit 'set' and 'delete' methods in redis.rb (see my fork) to get around this. I haven't fully tested every redis command after my modifications to check for other possible collisions.

@ezmobius
Copy link

Don't use redis with sinatra in default sinatra mode. You will have to use Sinatra::Application to contain your sintra apps to keep them from poluting the global namespace and fubaring redis.

@pzingg
Copy link
Author

pzingg commented Feb 13, 2010

Unfortunately I'm using a framework within a framework. My application is a subclass of Padrino::Application, which is a subclass of Sinatra::Application. The errors came within the padrino "controllers" which are simply instance_evals within the application class that call "get" and "delete". My redis#get and redis#delete calls are inside of these routing statements, which call methods in an instance of Usher::Interface::Rack::Builder, the routing code. Somehow the redis#get and redis#delete end up somewhere else.trying to call the Rack::Builder methods. I guess I'll stick with my get and delete patch to redis until I can spend enough time to figure out what ruby is doing when it tries to resolve these "get" and "delete" method calls.

@ezmobius
Copy link

I don't understand how this works. is sinatra defining 'get' and 'set' in the Kernel or Object namespace or something? If so thats pretty gross :( I'd rather not patch redis-rb to work around a sintra bug that should probabky be fixed in sinatra.

But perhaps we could add an extra file sinatra_safe.rb with your patches that allow you to require this if you really need it? Not sure whats best here

@pzingg
Copy link
Author

pzingg commented Feb 13, 2010

I don't understand it either. So I don't recommend doing anything to your code base until I find out the mechanism involved. It might be that I have to add "::" or something somewhere in my application code.

This issue was closed.
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