Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6766: monkey_patch.rb

File monkey_patch.rb, 286 bytes (added by lourens, 2 years ago)

Temporary monkey patch to solve this problem

Line 
1 ActiveRecord::Base.class_eval do
2  
3   before_save :set_inheritance_column_attribute_fix
4  
5   protected
6  
7   def set_inheritance_column_attribute_fix
8     self[self.class.inheritance_column] = self.class.to_s if self.class.columns_hash.include?(self.class.inheritance_column)
9   end
10  
11 end