Fix sinatra base #15

Merged
merged 2 commits into from Jul 18, 2012

Projects

None yet

3 participants

@akatz
akatz commented Jul 18, 2012

fixes for issue #14

@ejschmitt ejschmitt merged commit b3b9455 into ejschmitt:master Jul 18, 2012
@ejschmitt
Owner

thanks

@ankane
ankane commented Mar 2, 2013

Hey Erick,

Please bump the version number of the gem. This commit fixes a huge, unobvious issue.

When sinatra is required, this line is executed in the main space.
https://github.com/sinatra/sinatra/blob/master/lib/sinatra/main.rb#L30

Here's the issue we ran into with Rails 3.2.12 and scopes. (not_found is a scope on the Item model)

# works - returns models
Item.not_found

order = Order.find(1)
order.items.not_found # => returns 404 instead of models

The not_found method is delegated to the sinatra application rather than the rails activerelation after we installed this gem. This commit fixes the problem.

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