On May 18, 2011, at 7:35 PM, Ronny Hanssen wrote:

> When loading the alternative 1 (index) the log ouputs the following (I have 
> "set_default_order 'updated_at DESC' in the Job-model)
> Started GET "/jobs" for 127.0.0.1 at 2011-05-19 01:13:00 +0200
> ...
>   Processing by JobsController#index as HTML
>   SQL (0.0ms)  SELECT COUNT(*) FROM "users"
>   User Load (1.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 
> LIMIT 1
>   Job Load (17.0ms)  SELECT "jobs".* FROM "jobs" ORDER BY updated_at DESC 
> LIMIT 10 OFFSET 0
>   SQL (1.0ms)  SELECT COUNT(*) FROM "jobs"
>   User Load (3.0ms)  SELECT "users".* FROM "users" LIMIT 30
> This seems fine, 1 job query, limiting itself to 10 hits, ordered as default.
> 
> But, when I switch to using the alternative 2 index and use a scope 
> (alternative 2) the output looks like this (even without any specific order 
> specified):'
> Started GET "/jobs" for 127.0.0.1 at 2011-05-19 01:15:31 +0200
> ...
>   Processing by JobsController#index as HTML
>   SQL (0.0ms)  SELECT COUNT(*) FROM "users"
>   User Load (1.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 
> LIMIT 1
>   Job Load (89.0ms)  SELECT "jobs".* FROM "jobs" ORDER BY jobs.updated_at 
> DESC LIMIT 10 OFFSET 0
>   SQL (1.0ms)  SELECT COUNT(*) FROM "jobs"
>   Job Load (2653.2ms)  SELECT "jobs".* FROM "jobs" ORDER BY jobs.updated_at 
> DESC
>   User Load (3.0ms)  SELECT "users".* FROM "users" LIMIT 30
> As you can see, hobo/rails now executes the Job select-statement twice. One 
> time similar to the first select with a limit, as expected. The second select 
> is unexpected though.
> 
> Can anyone explain why and possibly pinpoint an error and/or a solution?

I've seen this happen before with when calling responds_to? on association / 
scope proxies. It was fixed in the 1.0 branch, but Rails 3 may have found a new 
way to mess it up.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to