Top "Rails-activerecord" questions

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

Difference between Active Model, Active Record and Active Resource

Is there anyone who can help me by defining the exact difference between Active Model, Active Record and Active Resource. …

ruby-on-rails-3 rails-activerecord activemodel activeresource
after_create with multiple methods?

I am trying to call two methods on an after create, but putting them into an array doesn't work... i …

ruby-on-rails ruby-on-rails-3 rails-activerecord
Rails 4 scope to find parents with no children

I found one answer that had some usable having examples for finding parents with n children, but the same is …

ruby-on-rails rails-activerecord
Possible to specify unique index with NULLs allowed in Rails/ActiveRecord?

I want to specify a unique index on a column, but I also need to allow NULL values (multiple records …

ruby-on-rails postgresql activerecord ruby-on-rails-4 rails-activerecord
Using raw sql queries in Rails 3 application?

I am working on migrating a legacy database into my Rails application (3.2.3). The original database comes with quite a few …

sql ruby-on-rails-3 model rails-activerecord legacy-database
How to combine two scopes with OR

I have a tag feed and a friend feed. I want to combine these two and build the ultimate "all" …

ruby-on-rails ruby-on-rails-3 database-design rails-activerecord
NoMethodError - undefined method 'find_by' for []:ActiveRecord::Relation

I've been following Michael Heartl tutorial to create a follow system but I have a strange error: "undefined method `find_…

ruby-on-rails devise rails-activerecord nomethoderror
In Rails' ActiveRecord, what is touch for?

I've heard of Rails' ActiveRecord/ActiveModel having something called "touch". However, I haven't found anything describing the purpose of this …

ruby-on-rails rails-activerecord
rails < 4.0 "try" method throwing NoMethodError?

Why is try throwing an error? Doesnt that defeat the whole purpose? Maybe its just in the console? ruby-1.9.2-p180 :101 &…

ruby-on-rails rails-activerecord nomethoderror
is there anyway to undo an activerecord delete in rails console?

I have made an unbelievably horrible mistake in script/console: user.delete Is there any way to undo that from …

ruby-on-rails rails-activerecord