Top "Rails-activerecord" questions

The implementation of object-relational mapping (ORM) using the Active Record pattern in the Ruby on Rails framework.

How can I avoid running ActiveRecord callbacks?

I have some models that have after_save callbacks. Usually that's fine, but in some situations, like when creating development …

ruby-on-rails ruby rails-activerecord
ActiveRecord: size vs count

In Rails, you can find the number of records using both Model.size and Model.count. If you're dealing with …

ruby-on-rails ruby ruby-on-rails-3 rails-activerecord
Combine two ActiveRecord::Relation objects

Suppose I have the following two objects: first_name_relation = User.where(:first_name => 'Tobias') # ActiveRecord::Relation last_name_…

ruby-on-rails rails-activerecord arel
LEFT OUTER JOIN in Rails 4

I have 3 models: class Student < ActiveRecord::Base has_many :student_enrollments, dependent: :destroy has_many :courses, through: :student_enrollments …

sql ruby-on-rails ruby-on-rails-4 rails-activerecord mysql2
scopes with lambda and arguments in Rails 4 style?

I'm wondering how the following is done in Rails 4 or if I just use the Rails 3 approach for using a …

ruby-on-rails-4 scope rails-activerecord
Random record in ActiveRecord

I'm in need of getting a random record from a table via ActiveRecord. I've followed the example from Jamis Buck …

ruby-on-rails random rails-activerecord
Add timestamps to an existing table

I need to add timestamps (created_at & updated_at) to an existing table. I tried the following code but …

ruby-on-rails ruby rails-activerecord rails-migrations
How to skip ActiveRecord callbacks?

Possible Duplicate: How can I avoid running ActiveRecord callbacks? I have model like this class Vote < ActiveRecord::Base after_…

ruby-on-rails rails-activerecord
How to get record created today by rails activerecord?

How should I write the conditional statement for when I want to get all the records which were created today?

ruby-on-rails date rails-activerecord
Rails 3 datatypes?

Where can I find a list of data types that can be used in rails 3? (such as text, string, integer, …

ruby-on-rails ruby ruby-on-rails-3 rails-activerecord