Named scope is newer than Rails 1.2, so forgive me asking:

Is named scope incapable of working without hitting the database, or should it 
work fine in theory unless you've got SQL in it?

Andrew

On 26/08/2011, at 3:03 PM, Dmytrii Nagirniak <[email protected]> wrote:

> I would have thought this situation would be fairly common in a rails
> application, how are people handling this currently?
> 
> I would just hit the database. Correct behavior here would be more important 
> than couple of milliseconds saved.
> 
> It reminds me 2 things:
> 
> 1. When rails 3  was released it could not boot even though all tests passed. 
> The reason was that boot-up process was stubbed (don't remember exact details 
> though).
> 
> 2. you can't stub one of the most powerful things - plain SQL. I saw people 
> stubbing it and checking SQL that would be executed. It might work, but it is 
> something that is too much detached from real situation.
> 
> I might be in minority, but I prefer to stub as little as possible. Most of 
> it would be something without consistent state (database has consistent 
> state), availability etc. Not necessarily external services (http requests), 
> but internal as well (Time).
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" 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/rails-oceania?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" 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/rails-oceania?hl=en.

Reply via email to