Questions tagged [meta-where]
24 questions
225
votes
9 answers
Want to find records with no associated records in Rails
Consider a simple association...
class Person
has_many :friends
end
class Friend
belongs_to :person
end
What is the cleanest way to get all persons that have NO friends in ARel and/or meta_where?
And then what about a has_many :through…

craic.com
- 3,786
- 5
- 22
- 17
5
votes
1 answer
Rails Searching calculated fields using metasearch and metawhere
Has anyone been able to find a way to search a calculated field using metawhere or metasearch in rails 3? I can search any field but calculated fields. There has to be a way. For anyone not familiar with metasearch or metawhere here is a…

user893447
- 71
- 1
- 3
3
votes
1 answer
Selecting unique rows when doing a join
Fist a little background:
I'm using Rails 3.0.7, Postgres 9.0 and MetaWhere/MetaSearch 1.0.4
I have a very frustrating problem with getting the unique records when querying the my database.
I have 3 models as follows:
class Car < ActiveRecord::Base
…

Niels Kristian
- 8,661
- 11
- 59
- 117
2
votes
1 answer
ruby on rails 3 - advanced searches using gems
I have a User model with columns for Local, Skype, and Phone (boolean, 't' or 'f') and Gender (string, 'Male' or 'Female'). Each user can have many skills in the associated SkillMap model which has the skill_id and direction (string, either "Teach"…

joshblour
- 1,024
- 10
- 19
2
votes
0 answers
Custom query with Squeel on equality of two attributes to ordered pairs
I'm having difficulty writing a query, whether in SQL or not, but I'd like to be able to write it in ruby using the gem Squeel. Basically, I have a class:
class Article < ActiveRecord::Base
belongs_to :genre
belongs_to :publisher
...
end
I…

dcashman
- 197
- 10
2
votes
1 answer
Migrating from MetaWhere to Squeel and away from using symbols
I have an application where I want to migrate from MetaWhere to Squeel in preparation for an upgrade to Rails 3.1.
This has been mostly a simple process but I have one case that causes me a bit of problems. The problem is that I have both the field…

HakonB
- 6,977
- 1
- 26
- 27
2
votes
1 answer
SQL query for field content containing whole words that begin with PHRASE
I am trying to write a SQL query to fetch rows whose fields contain multiple key words. The use for the query is to fetch results for an autocompleter function implemented with jQuery.
Right now, the autocompletion works, but my results will…

Ben
- 739
- 6
- 25
1
vote
1 answer
Is it possible to do an "OR" on two ActiveRecord scopes using MetaWhere?
Is it possible to do an "OR" on two scopes?
For example, consider a simple example where I have a class User with 2 scopes - professors and lecturers
Then, can I re-use the 2 scopes to get users who may be either professors or lecturers?
Some thing…

Nikhil Gupte
- 3,266
- 4
- 25
- 15
1
vote
2 answers
why am I getting a metawhere join dependency error in Rails 3?
I get a metawhere join dependency error with the following:
@companies_user = Company.joins(:contact).where(:contact => {:user_id => current_user.id}).uniq
Company has_many contacts
In other words, every Contact has a method company_id
I want to…

Satchel
- 16,414
- 23
- 106
- 192
1
vote
1 answer
how would I translate this from searchlogic to metwhere in Rails 3?
I had the following in searchlogic:
Todo.contact_id_is(self.id).ascend_by_original_date.done_date_not_null.first
How would I do this in metawhere now that I am in Rails 3? In particular the not_null and the sorting?
Hello, I'm a little confused. …

Satchel
- 16,414
- 23
- 106
- 192
1
vote
1 answer
Ruby-on-rails gem failing for "where" condition of meta_where
I have a question about what is probably a gems problem, but may be meta-where. I used gems to install meta_where-1.0.4, and the response was that I succeeded and the uri for meta_where was provided, but when I tried a where-condition in the search…

user32848
- 249
- 1
- 3
- 13
1
vote
2 answers
How can I search through a has_many association in Rails 3 (meta_where or railslogic?)
I have a model called UserHasMessages where:
belongs_to :message
belongs_to :user
And User.rb model is:
has_many :messages, :through => :user_has_messages
I want to find Users where the associated UserHasMessages has a Message_id of @message.id
I…

Satchel
- 16,414
- 23
- 106
- 192
1
vote
1 answer
How to write this SQL in MetaWhere?
How would I write this query using MetaWhere (in Rails 3)?
SELECT "users".* FROM "users"
INNER JOIN "friendships" friends
ON "users"."id" = friends."friend_id"
INNER JOIN "friendships" inverse_friends
ON "users"."id" =…

neezer
- 19,720
- 33
- 121
- 220
1
vote
1 answer
Searching tags with metawhere
I'm trying to perform a multi-column search on a model and it's associated tags. I'm using metawhere and acts-as-taggable-on for this. Basically I have a model with a title and body that has a certain amount of tags with names. I've been trying…

Raj
- 13
- 3
1
vote
1 answer
Proper syntax and use cases for MetaWhere in_all and in_any
I've been exploring the capabilities of MetaWhere over the last couple of days. Most of the predications are pretty straightforward, but I'm stuck on how to use in_all and in_any.
Here are some of my attempts:
Group.where(:id.in_any => [1,2,3])
…

tsherif
- 11,502
- 4
- 29
- 27