Questions tagged [meta-where]

24 questions
0
votes
1 answer

Using Squeel or Meta_where with Sinatra

I am using the ActiveRecord stuff in Sinatra and I'm wondering if it will work with meta_where or (preferably) squeel? I'm going to start trying but I was hoping perhaps someone could short circuit me.
jaydel
  • 14,389
  • 14
  • 62
  • 98
0
votes
2 answers

MetaWhere to Squeel migration

In MetaWhere I combined conditions to sql variable using loops, if else statements. sql = {} email_starts_with = "vany%" sql["growth"] = 0..200 sql = sql & (:rating > 50) sql = sql & (:email =~…
vany
  • 421
  • 1
  • 3
  • 13
0
votes
2 answers

How do I do this query using metawhere and joins?

I have User.rb: has_many :sent_messages, :class_name => "Message", :foreign_key => "sent_messageable_id" Each Message.rb has an account_id and a :givereceive method: belongs_to :account I want to create a method for the Account.rb model so that I…
Satchel
  • 16,414
  • 23
  • 106
  • 192
0
votes
1 answer

How would I use metawhere to search through associations and join the tables?

I have two models: Message and UserMessage. I got this architecture from somewhere else on SO, but am having some challenges. Each Message has TWO UserMessage: one UserMessage has a user_id of the sender, and the other has a user_id of the…
Satchel
  • 16,414
  • 23
  • 106
  • 192
0
votes
1 answer

How do I search through associations in metawhere in Rails 3?

When I was using searchlogic, I couuld use the following: 27 # @todos = Todo.contact_user_id_is(current_user). 28 # contact_campaign_id_is(@campaign). 29 # current_date_lte(Date.today). 30 # …
Satchel
  • 16,414
  • 23
  • 106
  • 192
0
votes
1 answer

How can I convert that to MetaWhere or Arel?

Consider a City Model having: def self.search(field, search) if search where("#{field} LIKE ?", "%#{search}%") else scoped end end How can I use Arel or Metawhere in that situation knowing that field is a String can have…
user668531
0
votes
1 answer

Multiple LIKE matches with Arel & MetaWhere

I'm transitioning an application written in Rails-2.3 with SearchLogic to Rails-3.0 with Arel and MetaWhere, and I'm running into an operation that I don't know how the write. The old code was: if params[:city] && params[:city].respond_to?(:each) …
Adam Lassek
  • 35,156
  • 14
  • 91
  • 107
0
votes
1 answer

meta_search with meta_where gem

I'm using meta_search and meta_where gem.In my controller file: @search = Project.where('end <= ?', Time.zone.now) @search = @search.search(params[:search]) When I run this code I have error in browser like this PG::Error: ERROR: syntax error at…
James Fox
  • 27
  • 1
  • 1
  • 4
0
votes
1 answer

Metawhere abstract conditions from query

I'm using the Metawhere rails gem to query my dbase. I have a query that works: t=Model.where({:attr1 => 450} | {:attr2 => 450}, :lang => 2) now I trying to abstract the conditions from the query like this: conditions=Hash[{:attr1 => 450} | {:attr2…
Rutger
  • 185
  • 2
  • 11
1
2