On Fri, Jul 24, 2009 at 5:48 AM, Joao Silva <
[email protected]> wrote:

>
> Update:
>
> For ignored:
>
> @messages = @brand.messages.ignored.paginate :per_page => 25, :page =>
> params[:page]
>
> Message Load (4.0ms)   SELECT * FROM `messages` WHERE
> (`messages`.brand_id = 2) AND (((`messages`.`ignored` = 0)) AND
> ((`messages`.`ignored` = 0) AND (`messages`.brand_id = 2))) ORDER BY
> posted_on DESC LIMIT 0, 25
>

This looks rather odd because you have the following statements specified
twice:

(`messages`.brand_id = 2)
(`messages`.`ignored` = 0)

Should the named_scope, :ignored, be set to true or false?  Also, what the
expected
resultset that should be returned from the following statement:

Message.ignored

I would recommend building your named_scopes one at a time to get the result
that
you're looking for at each step.


>
>
> For all:
>
> @messages = @brand.messages.all.paginate :per_page => 25, :page =>
> params[:page]
>
> Message Load (9.5ms)   SELECT * FROM `messages` WHERE
> ((`messages`.`ignored` = 0) AND (`messages`.brand_id = 2)) ORDER BY
> posted_on DESC
>

Same comments as the above.

-Conrad


>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to