Top "Activerecord" questions

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

How do you scope ActiveRecord associations in Rails 3?

I have a Rails 3 project. With Rails 3 came Arel and the ability to reuse one scope to build another. I …

ruby-on-rails activerecord ruby-on-rails-3 named-scope arel
Determine if ActiveRecord Object is New

How can I check if an ActiveRecord object is new or is already persisted?

ruby-on-rails activerecord
ActiveRecord: List columns in table from console

I know that you can ask ActiveRecord to list tables in console using: ActiveRecord::Base.connection.tables Is there a …

sql ruby-on-rails ruby-on-rails-3 activerecord
How can I see the SQL that will be generated by a given ActiveRecord query in Ruby on Rails

I would like to see the SQL statement that a given ActiveRecord Query will generate. I recognize I can get …

sql ruby-on-rails activerecord
UNION query with codeigniter's active record pattern

How to do UNION query with PHP CodeIgniter framework's active record query format?

mysql sql codeigniter activerecord union
Converting an array of objects to ActiveRecord::Relation

I have an array of objects, let's call it an Indicator. I want to run Indicator class methods (those of …

ruby-on-rails ruby activerecord
How to return an empty ActiveRecord relation?

If I have a scope with a lambda and it takes an argument, depending on the value of the argument, …

ruby-on-rails activerecord relation
ActiveRecord Query Union

I've written a couple of complex queries (at least to me) with Ruby on Rail's query interface: watched_news_posts = …

ruby-on-rails activerecord union active-relation
ActiveRecord: How to get all attributes of a model that can be mass-assigned?

I would like to have a list of all attribute names that can be mass assigned. I need this for …

ruby-on-rails activerecord
Rails 3 skip validations and callbacks

I have a particularly complex model with validations and callbacks defined. The business needs now calls for a particular scenario …

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