restly 0.0.1.alpha.11 → 0.0.1.alpha.12
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.
@@ -18,8 +18,12 @@ module Restly::Associations::Base::Stubs
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def stub_instance(parent, attributes)
|
21
|
-
|
22
|
-
|
21
|
+
if attributes.is_a?(association_class)
|
22
|
+
attributes
|
23
|
+
else
|
24
|
+
new_instance = association_class.new(attributes, loaded: embedded?)
|
25
|
+
Restly::Proxies::Associations::Instance.new(new_instance, parent)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
|
25
29
|
end
|
data/lib/restly/associations.rb
CHANGED
data/lib/restly/base/includes.rb
CHANGED
@@ -17,7 +17,12 @@ module Restly::Base::Includes
|
|
17
17
|
|
18
18
|
def has_specification
|
19
19
|
self.fields = Restly::Base::Resource::Specification.new(self).fields
|
20
|
+
|
21
|
+
self._accessible_attributes = accessible_attributes_configs.dup
|
22
|
+
|
20
23
|
(self._accessible_attributes ||= {})[:default] = Restly::Base::Resource::Specification.new(self).accessible_attributes
|
24
|
+
|
25
|
+
self._active_authorizer = self._accessible_attributes
|
21
26
|
end
|
22
27
|
|
23
28
|
def connection
|
@@ -19,7 +19,7 @@ module Restly::Base::Instance::WriteCallbacks
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def savable_resource
|
22
|
-
{resource_name => attributes_with_present_values(
|
22
|
+
{resource_name => attributes_with_present_values(writable_attributes)}
|
23
23
|
end
|
24
24
|
|
25
25
|
def attributes_with_present_values(attributes=self.attributes)
|
@@ -33,11 +33,15 @@ module Restly::Base::Instance::WriteCallbacks
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
36
|
+
def writable_attributes(attributes=self.attributes)
|
37
|
+
maa = mass_assignment_authorizer(:default)
|
38
|
+
|
39
|
+
if maa.is_a? ActiveModel::MassAssignmentSecurity::BlackList
|
38
40
|
attributes.reject{ |key, val| maa.map(&:to_sym).include?(key.to_sym) }
|
39
|
-
|
41
|
+
|
42
|
+
elsif maa.is_a? ActiveModel::MassAssignmentSecurity::WhiteList
|
40
43
|
attributes.select{ |key, val| maa.map(&:to_sym).include?(key.to_sym) }
|
44
|
+
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
data/lib/restly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.alpha.
|
4
|
+
version: 0.0.1.alpha.12
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
@@ -463,4 +463,3 @@ test_files:
|
|
463
463
|
- spec/support/requester.rb
|
464
464
|
- spec/support/routes.rb
|
465
465
|
- spec/support/shared.rb
|
466
|
-
has_rdoc:
|