suppose we got two models: category and article.
category has_many articles, article belongs_to category

article has a named_scope defined by
named_scope :online, :conditions => {:state => 2}

in the controller i want to search for online articles that belongs to
a given category. i tried this query:
@category.articles.online.find(params[:id))
it works, but it duplicates the condition about the category in the
generated SQL:
SELECT * FROM "articles" WHERE ("articles"."id" = 6 AND
("articles".category_id = 1)) AND (("articles"."state" = 2) AND
("articles".category_id = 1))

am i missing something?
--~--~---------~--~----~------------~-------~--~----~
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