forceps 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/forceps/client.rb +15 -2
- data/lib/forceps/version.rb +1 -1
- data/test/dummy/db/remote.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +2336 -0
- metadata +3 -3
data/lib/forceps/client.rb
CHANGED
@@ -53,11 +53,24 @@ module Forceps
|
|
53
53
|
|
54
54
|
include Forceps::ActsAsCopyableModel
|
55
55
|
|
56
|
-
|
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)
|
data/lib/forceps/version.rb
CHANGED
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|