Top "Rails-activerecord" questions

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

Rails update_attributes without save?

Is there an alternative to update_attributes that does not save the record? So I could do something like: @car = …

ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 rails-activerecord
Rails :include vs. :joins

This is more of a "why do things work this way" question rather than a "I don't know how to …

ruby-on-rails ruby database join rails-activerecord
find vs find_by vs where

I am new to rails. What I see that there are a lot of ways to find a record: find_…

ruby-on-rails rails-activerecord dynamic-finders
How to express a NOT IN query with ActiveRecord/Rails?

Just to update this since it seems a lot of people come to this, if you are using Rails 4 look …

ruby-on-rails rails-activerecord
ActiveRecord find and only return selected columns

edit 2 If you stumble across this, check both answers as I'd now use pluck for this I have a fairly …

ruby-on-rails ruby-on-rails-3 rails-activerecord
ActiveRecord OR query

How do you do an OR query in Rails 3 ActiveRecord. All the examples I find just have AND queries. Edit: …

ruby-on-rails ruby-on-rails-3 rails-activerecord
Float vs Decimal in ActiveRecord

Sometimes, Activerecord data types confuse me. Err, often. One of my eternal questions is, for a given case, Should I …

ruby-on-rails types floating-point decimal rails-activerecord
How do you write a migration to rename an ActiveRecord model and its table in Rails?

I'm terrible at naming and realize that there are a better set of names for my models in my Rails …

ruby-on-rails migration rails-activerecord
How to change default timezone for Active Record in Rails?

In my application.rb I came across the following comment # Set Time.zone default to the specified zone and make …

ruby-on-rails ruby timezone rails-activerecord
How to chain scope queries with OR instead of AND?

I'm using Rails3, ActiveRecord Just wondering how can I chain the scopes with OR statements rather than AND. e.g. …

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