Top "Activerecord" questions

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

Increment field of mysql database using codeigniter's active record syntax

I have the following php-codeigniter script which attempts to increment a field of a record using active-record syntax: $data = array(…

mysql sql codeigniter activerecord
dependent => destroy on a "has_many through" association

Apparently dependent => destroy is ignored when also using the :through option. So I have this... class Comment < ActiveRecord::…

ruby-on-rails activerecord has-many-through
Rails find record with zero has_many records associated

This seems fairly simple but I can't get it to turn up on Google. If I have: class City < …

sql ruby-on-rails activerecord has-many
Rails - Best-Practice: How to create dependent has_one relations

Could you tell me whats the best practice to create has_one relations? f.e. if i have a user …

ruby-on-rails ruby activerecord ruby-on-rails-3 associations
Rails: Order with nulls last

In my Rails app I've run into an issue a couple times that I'd like to know how other people …

ruby-on-rails ruby-on-rails-3 sorting activerecord null
Bulk Insert records into Active Record table

I found that my Model.create! statements were taking a very long time to run when I added a large …

ruby-on-rails activerecord bulkinsert
ActiveRecord::StatementInvalid: PG InFailedSqlTransaction

I am trying to create an ActiveRecord Object.But I'm getting this error while creating it. (0.1ms) ROLLBACK ActiveRecord::StatementInvalid: …

ruby-on-rails postgresql activerecord rollback pg
Postgres on Rails FATAL: database does not exist

I've reinstalled Postgres (9.2.4) and I'm having trouble getting it set back up with Rails 3.2.11. I did: brew install postgresql initdb /…

ruby-on-rails ruby-on-rails-3 postgresql activerecord database-migration
Check if record was just destroyed in rails

So there is record.new_record? To check if something is new I need to check if something is on …

ruby-on-rails ruby activerecord
belongs_to with :class_name option fails

I have no idea what went wrong but I can't get belongs_to work with :class_name option. Could somebody …

ruby-on-rails activerecord associations