Module: Ronin::DB::Model::HasName::ClassMethods
- Defined in:
- lib/ronin/db/model/has_name.rb
Overview
Class methods that are added when Ronin::DB::Model::HasName is included into a model.
Instance Method Summary collapse
-
#named(fragment) ⇒ Array<Model>
Finds models with names containing a given fragment of text.
Instance Method Details
#named(fragment) ⇒ Array<Model>
Finds models with names containing a given fragment of text.
75 76 77 78 79 |
# File 'lib/ronin/db/model/has_name.rb', line 75 def named(fragment) name_column = self.arel_table[:name] where(name_column.matches("%#{sanitize_sql_like(fragment)}%")) end |