RailsCasts Pro episodes are now free!

Learn more or hide this

Mitch Statz's Profile

GitHub User: nucleoid

Comments by Mitch Statz


FYI, to those that have :inheritance_column set to something other than :type on the class you are calling :reset_column_information, make sure you set it again after the :reset_column_information call or it will give you the "column 'type' is reserved" error when running the migration.

This is because the class :inheritance_column setting is effectively ignored after you call :reset_column_information after the class is loaded. So, in short, assuming the Project class had :inheritance_column set to something other than :type, your migration should be:

Project.inheritance_column = nil #or whatever you have it set to
  Project.find(:all).each do |p|
    Project.update_counters p.id, :tasks_count => p.tasks.length

Took a while for me to realize what was going on, so hopefully this saves someone some time.


Perfect! This was exactly what I am needing - the blog-post/calendar display at the end.