Rails: Using greater than/less than with a where statement
I’m trying to find all Users with an id greater than 200, but I’m having some trouble with the specific syntax. User.where(:id > … Read more
I’m trying to find all Users with an id greater than 200, but I’m having some trouble with the specific syntax. User.where(:id > … Read more
I need to add timestamps (created_at & updated_at) to an existing table. I tried the following code but it didn’t work. class AddTimestampsToUser … Read more
Suppose I have the following two objects: first_name_relation = User.where(:first_name => ‘Tobias’) # ActiveRecord::Relation last_name_relation = User.where(:last_name => ‘Fünke’) # ActiveRecord::Relation is it … Read more
I have a rake task that won’t work unless a table exists. I’m working with more than 20 engineers on a website so … Read more
How do you do an OR query in Rails 3 ActiveRecord. All the examples I find just have AND queries. Edit: OR method … Read more
I need to query comments made in one day. The field is part of the standard timestamps, is created_at. The selected date is … Read more
Is there a rails-way way to validate that an actual record is unique and not just a column? For example, a friendship model … Read more
Please help me in understanding the :source option of has_one/has_many :through association. The Rails API explanation makes very little sense to me. “Specifies … Read more
I have a list of events that I fetch. I’m trying to include every user associated to this event and every profile associated … Read more
In Rails, you can find the number of records using both Model.size and Model.count. If you’re dealing with more complex queries is there … Read more