active-record-query Questions
5
Solved
I have a Client model and a Product model where a Client has many Products and a Product belongs to a CLient.
I need to find a query that only returns Clients if they have a record in the Product ...
Sori asked 7/1, 2013 at 1:54
3
Solved
This is one example of one entry in my database:
Market id: 1, name: "Independence Park (Independently Run Farmers Market...", address: "3945 N. Springfield Ave., Chicago, IL", zipcode: "60618", c...
Booted asked 3/1, 2013 at 16:32
2
Solved
I have the following query in my Gallery model:
media_items.includes(:photo, :video).rank(:position_in_gallery)
My Gallery Model has_many Media Items which each have either a Photo or Video asso...
Bi asked 13/1, 2017 at 17:6
5
Solved
I have a database that I want to pull only certain rows that have dates in specified ranges. I'm not sure how to do this properly in active record. Right now it looks like I'm running a standard my...
Faydra asked 24/8, 2012 at 1:36
4
Solved
I take naming pretty seriously, so I think pretty hard about good names for my ActiveRecord models. However, I frequently come up with a name and it has some conflict with a reserved name, either i...
Longhair asked 6/12, 2012 at 18:20
1
Solved
I have category model and category has many postings.
Problem: Sometimes postings are not visible under category in web even records are present in database
I investigated the query for the actio...
Floris asked 13/3, 2017 at 9:28
4
Solved
I have a schema like this.
managers
has_many :emails
has_many :stores
emails
belongs_to :manager
stores
belongs_to :manager
belongs_to :region
regions
has_many :stores
has_many ...
Ridgway asked 4/10, 2013 at 6:53
1
Solved
If I have a model Person, which has_many Vehicles and each Vehicle can be of type car or motorcycle, how can I query for all persons, who have cars and all persons, who have motorcycles?
I don't t...
Xanthene asked 13/5, 2014 at 13:56
1
I have a table with an column "Ip" all has the values like 10.x.x.x, now I want to replace the 10 with 20 of all the records. Is their any way to do this via Activerecord or Do I need to execute on...
Franklyn asked 13/3, 2014 at 11:34
1
Solved
I know you can run a copy command like this from a file:
"COPY zip_codes FROM '/path/to/csv/ZIP_CODES.txt' DELIMITER ',' CSV;"
I'd like to copy csv data from a ruby variable so I can do like so
...
Macfadyn asked 7/6, 2013 at 19:15
3
Solved
Having this:
class Event < ActiveRecord::Base
belongs_to :historizable, :polymorphic => true
end
user = User.create!
I can:
Event.create!(:historizable => user)
But I can't:
Event...
Allhallows asked 7/2, 2013 at 14:35
2
Solved
I have a model called Event and another called Product. An event has many products and a product has many events (through the join model called Eventproduct). I am trying to design a query that wil...
Wickman asked 2/7, 2012 at 13:5
1
© 2022 - 2024 — McMap. All rights reserved.