Displaying 1 result from an estimated 1 matches for "viewable_listing".
Did you mean:
viewable_listings
2006 Jan 09
3
Selecting a subset of a table with DRY
...#39;' There are a certain combination of
properties which make a listing viewable (e.g., it is confirmed, has
been authorized, hasn''t expired, etc.). Each listing has one and only
one category.
I want to be able to do things like Listing.find_viewable(...) and
Category.find(...).viewable_listings, but I see no way to do this
without violating DRY in several places, or stepping all over AR''s toes.
My idea was to define a method in application.rb which returns the
appropriate SQL string that makes a listing viewable, call it
viewable_sql, and then put that where appropriate. Ho...