activerecord_sqlserver_crm 5.1.2 → 5.1.3
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.
- checksums.yaml +4 -4
- data/lib/active_record_extension.rb +57 -1
- data/lib/activerecord_sqlserver_crm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 883aa94a5b12bdc0d1af9c60f1a7c2a804556717
|
4
|
+
data.tar.gz: e86ab147af32ee872c652d59011eff0319911fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be3991ffe7c87808a3640011f81148ae63c74a7bb2d4513587f965421a4b20d5b89a4ad3aefb2b5da5f04c88c9306ef560a312a4562bac7169b89111da703580
|
7
|
+
data.tar.gz: 9824c7db65af61edd8fc6bf2198f189e135988b4141fc8b9ad59c5f20c8b2952a916d88921afc7dd63665697d16761ebf5d1870645bc19931913b8fe012ec1bf
|
@@ -41,7 +41,7 @@ module ActiveRecordExtension
|
|
41
41
|
if has_errors
|
42
42
|
raise_validation_error
|
43
43
|
else
|
44
|
-
|
44
|
+
reload_after_odata unless id.nil?
|
45
45
|
end
|
46
46
|
!has_errors
|
47
47
|
end
|
@@ -53,11 +53,67 @@ module ActiveRecordExtension
|
|
53
53
|
save
|
54
54
|
end
|
55
55
|
|
56
|
+
# Created a method here because could not override ActiveRecord Persistance module because 3
|
57
|
+
# other modules override the reload method.
|
58
|
+
# I'm not really that thrilled with what I did here with this method for reload.
|
59
|
+
# Basically got parts from various ActiveRecord modules and combined them in here. I followed
|
60
|
+
# the reload through byebug to see how "reload" was being called
|
61
|
+
def reload_after_odata(options = nil)
|
62
|
+
# aggregations.rb
|
63
|
+
clear_aggregation_cache
|
64
|
+
|
65
|
+
# autosave_association.rb
|
66
|
+
@marked_for_destruction = false
|
67
|
+
@destroyed_by_association = nil
|
68
|
+
|
69
|
+
# associations.rb
|
70
|
+
clear_association_cache
|
71
|
+
|
72
|
+
# persistence.rb (only 1 line of code chaned in here)
|
73
|
+
self.class.connection.clear_query_cache
|
74
|
+
|
75
|
+
fresh_object =
|
76
|
+
if options && options[:lock]
|
77
|
+
self.class.unscoped { self.class.lock(options[:lock]).find(id) }
|
78
|
+
else
|
79
|
+
# Remove unscope here
|
80
|
+
self.class.find(id)
|
81
|
+
end
|
82
|
+
|
83
|
+
@attributes = fresh_object.instance_variable_get("@attributes")
|
84
|
+
@new_record = false
|
85
|
+
|
86
|
+
# attribute_methods/dirty.rb
|
87
|
+
@previous_mutation_tracker = nil
|
88
|
+
clear_mutation_trackers
|
89
|
+
@changed_attributes = ActiveSupport::HashWithIndifferentAccess.new
|
90
|
+
|
91
|
+
self
|
92
|
+
end
|
93
|
+
|
94
|
+
|
56
95
|
def update_attribute(name, value)
|
57
96
|
write_attribute(name,value)
|
58
97
|
save
|
59
98
|
end
|
60
99
|
|
100
|
+
# If using default_scope to restrict fields returned (with select)
|
101
|
+
# Change reload so it still uses the default scope rather than unscoped
|
102
|
+
def reload(options = nil)
|
103
|
+
self.class.connection.clear_query_cache
|
104
|
+
|
105
|
+
fresh_object =
|
106
|
+
if options && options[:lock]
|
107
|
+
self.class.unscoped { self.class.lock(options[:lock]).find(id) }
|
108
|
+
else
|
109
|
+
self.class.find(id)
|
110
|
+
end
|
111
|
+
|
112
|
+
@attributes = fresh_object.instance_variable_get("@attributes")
|
113
|
+
@new_record = false
|
114
|
+
self
|
115
|
+
end
|
116
|
+
|
61
117
|
# add your static(class) methods here
|
62
118
|
module ClassMethods
|
63
119
|
def belongs_to_field?(field)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_sqlserver_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rolf Lawrenz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|