Methods
Public Instance methods
find_with_any_tag(*names)

Find objects with any of the provided tags. UNION (OR)

     # File lib/og/model/taggable.rb, line 224
224:     def find_with_any_tag(*names)
225:       ogmanager.with_store do |store|
226:         relation = relations.reject{|r| r.name != :tags}.first
227:         info = store.join_table_info(relation)
228:         count = names.size
229:         names = names.map { |n| store.quote(n) }.join(',')
230:       end
231:       sql = %{        
232:         SELECT *
233:         FROM #{info[:owner_table]} AS o
234:         WHERE o.oid IN (
235:           SELECT j.#{info[:owner_key]}
236:           FROM #{info[:target_table]} AS t
237:           JOIN #{info[:table]} AS j
238:           ON t.oid = j.#{info[:target_key]}
239:           WHERE (t.name IN (#{names}))
240:           GROUP BY j.#{info[:owner_key]}
241:           )
242:       }
243:       return self.select(sql)
244:     end
find_with_tag(*names)

Alias for #find_with_tags

find_with_tags(*names)

Find objects with all of the provided tags. INTERSECTION (AND)

This method is also aliased as find_with_tag
     # File lib/og/model/taggable.rb, line 197
197:     def find_with_tags(*names)
198:       ogmanager.with_store do |store|
199:         relation = relations.reject{|r| r.name != :tags}.first
200:         info = store.join_table_info(relation)
201:         count = names.size
202:         names = names.map { |n| store.quote(n) }.join(',')
203:       end
204:       sql = %{
205:         SELECT *
206:         FROM #{info[:owner_table]} AS o
207:         WHERE o.oid IN (
208:           SELECT j.#{info[:owner_key]}
209:           FROM #{info[:target_table]} AS t
210:           JOIN #{info[:table]} AS j
211:           ON t.oid = j.#{info[:target_key]}
212:           WHERE (t.name IN (#{names}))
213:           GROUP BY j.#{info[:owner_key]}
214:           HAVING COUNT(j.#{info[:owner_key]}) = #{count}
215:         )
216:       }
217:       return self.select(sql)
218:     end