Hi all, I''m trying to develop a filter system to allow users search in database, for information. It will look like a e-mail filter, the user choose onde field and search one value: Field: Profession, Value: Developer or/and Field: Sex, Value: Woman and the system get this records in database and show. How I insert the new attributes in the Person model, first I do: def self.filtrable_fields return [''profession'',''age'',''sex'',''country''] end How I change to somethink like? def filter_by(*args) @filtrable_fields = *args end filter_by :profession, :sex What is the better way to develop this?? Exists some helper to help in it? Thank you -- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035
> Hi all, > > I''m trying to develop a filter system to allow users search in > database, for information. > It will look like a e-mail filter, the user choose onde field and > search one value: > Field: Profession, Value: Developer or/and Field: Sex, Value: Woman > and the system get this records in database and show. > > How I insert the new attributes in the Person model, first I do: > def self.filtrable_fields > return [''profession'',''age'',''sex'',''country''] > end > How I change to somethink like? > def filter_by(*args) > @filtrable_fields = *args > end > filter_by :profession, :sex > > What is the better way to develop this?? Exists some helper to help in > it? > > Thank you >-- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035