Top "Activerecord" questions

Active Record is a pattern that combines domain logic with storage abstraction in single object.

Ruby Activerecord IN clause

I was wondering if anyone knew how to do an "IN" clause in activerecord. Unfortunately, the "IN" clause is pretty …

ruby activerecord
How does Rails ActiveRecord chain "where" clauses without multiple queries?

I'm a PHP developer learning the awesomness of Ruby on Rails, I'm loving ActiveRecord and i noticed something really interesting, …

ruby-on-rails activerecord
Rails 3 + activerecord, the best way to "mass update" a single field for all the records that meet a condition

In rails 3, using activerecord, is there a single-query way to set the :hidden field to TRUE for all records that …

ruby-on-rails activerecord
Rails: ActiveRecord query based on association value

I have 2 models. Report and Server that have a belongs_to and has_many relationship. I created an accessor method …

ruby-on-rails ruby activerecord associations
Getting types of the attributes in an ActiveRecord object

I would like to know if it is possible to get the types (as known by AR - eg in …

ruby-on-rails ruby activerecord activemodel
Eager load polymorphic

Using Rails 3.2, what's wrong with this code? @reviews = @user.reviews.includes(:user, :reviewable) .where('reviewable_type = ? AND reviewable.shop_type = ?…

ruby-on-rails ruby-on-rails-3 activerecord
ActiveRecord serialize using JSON instead of YAML

I have a model that uses a serialized column: class Form < ActiveRecord::Base serialize :options, Hash end Is there …

ruby-on-rails json activerecord yaml serialization
Update one column to value of another in Rails migration

I have a table in a Rails app with hundreds of thousands of records, and they only have a created_…

ruby-on-rails activerecord migration timestamp
How can I know when to "refresh" my model object in Rails?

Here's part of an integration test that I'm having: user = User.first assert !user.is_active? get confirm_email_user_…

ruby-on-rails ruby testing activerecord
validates_uniqueness_of passes on nil or blank (without allow_nil and allow_blank)

The uniqueness validator of ActiveRecord has an options to skip validation if the value is nil or blank. Even if …

ruby-on-rails activerecord validates-uniqueness-of