Method: TaliaCore::ActiveSourceParts::Finders#find_by_uri_token
- Defined in:
- lib/talia_core/active_source_parts/finders.rb
#find_by_uri_token(token, options = {}) ⇒ Object
Find a list of sources which contains the given token inside the local name. This means that the namespace it will be excluded from the toke search
Example
Sources in system:
With these sources, you will get:
Source.find_by_uri_token('a') # => [ ]
Source.find_by_uri_token('o') # => [ 'http://talia.org/one', 'http://talia.org/two' ]
NOTE: It internally uses a MySQL function, as sql condition, to find the local name of the uri.
84 85 86 87 88 |
# File 'lib/talia_core/active_source_parts/finders.rb', line 84 def find_by_uri_token(token, = {}) find(:all, { :conditions => [ "LOWER(SUBSTRING_INDEX(uri, '/', -1)) LIKE ?", '%' + token.downcase + '%' ], :order => "uri ASC" }.merge!()) end |