forceps 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,11 +53,24 @@ module Forceps
53
53
 
54
54
  include Forceps::ActsAsCopyableModel
55
55
 
56
- def self.instantiate(record, column_types = {})
56
+ # Intercep intantiation of records to make the 'type' column point to the corresponding remote class
57
+
58
+ if Rails::VERSION::MAJOR >= 4
59
+ def self.instantiate(record, column_types = {})
60
+ __prepare_sti_column_for_forceps(record)
61
+ super
62
+ end
63
+ else
64
+ def self.instantiate(record)
65
+ __prepare_sti_column_for_forceps(record)
66
+ super
67
+ end
68
+ end
69
+
70
+ def self.__prepare_sti_column_for_forceps(record)
57
71
  if record[inheritance_column].present?
58
72
  record[inheritance_column] = "Forceps::Remote::#{record[inheritance_column]}"
59
73
  end
60
- super
61
74
  end
62
75
 
63
76
  # We don't want to include STI condition automatically (the base class extends the original one)
@@ -1,3 +1,3 @@
1
1
  module Forceps
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
Binary file
Binary file