Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created August 19, 2013 08:52
Show Gist options
  • Select an option

  • Save mashiro/6267009 to your computer and use it in GitHub Desktop.

Select an option

Save mashiro/6267009 to your computer and use it in GitHub Desktop.
module WhereLikeExtension
def where_like(opts, *rest)
return self if opts.blank?
spawn.where_like! opts, *rest
end
def where_like!(opts, *rest)
self.where_values += build_where(opts, rest).map { |r| Arel::Nodes::Matches.new r.left, r.right }
self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment