I would like to annotate my properties with a ":searchable" option,
that is then used by a search class scope to do a simple LIKE query
class Customer
property :company, String, :searchable => true
def self.search(term)
all(:company.like => "%#{term}%")
end
end
Finally I would like to build something like is_searchable mixin that
creates the search method in all classes that have at least one
property with the :searchable flag set.
If extending the possible options for property is not possible or not
recommended, then maybe the is_searchable mixin would take the
property names as arguments like this:
class Customer
is_searchable :company
end
Any thoughts?
PS: Yes I am aware of the existing is-searchable mixin but it uses a
second db repository iirc
--
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en.