search for: find_view

Displaying 1 result from an estimated 1 matches for "find_view".

Did you mean: found_view
2006 Jan 09
3
Selecting a subset of a table with DRY
..., I have table called ''listings.'' 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 view...