Module: ActiveRecord::LikeSearch
- Defined in:
- lib/ensembl/helpers/like_search.rb
Instance Method Summary collapse
- #contains(attribute, string) ⇒ Object
- #ends_with(attribute, string) ⇒ Object
- #starts_with(attribute, string) ⇒ Object
- #table ⇒ Object
Instance Method Details
#contains(attribute, string) ⇒ Object
15 16 17 |
# File 'lib/ensembl/helpers/like_search.rb', line 15 def contains(attribute,string) where(table[attribute].matches("%#{string}%")) end |
#ends_with(attribute, string) ⇒ Object
11 12 13 |
# File 'lib/ensembl/helpers/like_search.rb', line 11 def ends_with(attribute,string) where(table[attribute].matches("%#{string}")) end |
#starts_with(attribute, string) ⇒ Object
7 8 9 |
# File 'lib/ensembl/helpers/like_search.rb', line 7 def starts_with(attribute, string) where(table[attribute].matches("#{string}%")) end |
#table ⇒ Object
3 4 5 |
# File 'lib/ensembl/helpers/like_search.rb', line 3 def table self.arel_table end |