Top "Rails-activerecord" questions

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

How do you delete an ActiveRecord object?

How do you delete an ActiveRecord object? I looked at Active Record Querying and it does not have anything on …

ruby-on-rails rails-activerecord
Rails 4: List of available datatypes

Where can I find a list of data types that can be used in Ruby on Rails 4? Such as text …

ruby-on-rails ruby ruby-on-rails-4 rails-activerecord
Add a reference column migration in Rails 4

A user has many uploads. I want to add a column to the uploads table that references the user. What …

ruby-on-rails ruby-on-rails-4 rails-activerecord rails-migrations
How do I get the name of a Ruby class?

How can I get the class name from an ActiveRecord object? I have: result = User.find(1) I tried: result.class # =&…

ruby-on-rails ruby rails-activerecord
Rails where condition using NOT NIL

Using the rails 3 style how would I write the opposite of: Foo.includes(:bar).where(:bars=>{:id=>nil}) …

ruby-on-rails rails-activerecord arel
Ruby on Rails generates model field:type - what are the options for field:type?

I'm trying to generate a new model and forget the syntax for referencing another model's ID. I'd look it up …

ruby-on-rails generator rails-activerecord
ActiveModel::ForbiddenAttributesError when creating new user

I have this model in Ruby but it throws a ActiveModel::ForbiddenAttributesError class User < ActiveRecord::Base attr_accessor :password …

ruby-on-rails rails-activerecord
Rails: How can I set default values in ActiveRecord?

How can I set default value in ActiveRecord? I see a post from Pratik that describes an ugly, complicated chunk …

ruby-on-rails rails-activerecord
What is the easiest way to duplicate an activerecord record?

I want to make a copy of an activerecord record, changing a single field in the process (in addition to …

ruby-on-rails ruby rails-activerecord
Rails ActiveRecord date between

I need to query comments made in one day. The field is part of the standard timestamps, is created_at. …

ruby-on-rails rails-activerecord ruby-on-rails-2