trusty 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1ea62ba4eb9e305e64fb08259662e965019c41c
4
- data.tar.gz: 18f69b12dccb7c65835b4330617866fb3aaeeb22
3
+ metadata.gz: 46c17b62a8a0ccd79f67284a397b97f5537b55f9
4
+ data.tar.gz: 0a6eb00f7db619fe5b4aa9f7781778c7b5637107
5
5
  SHA512:
6
- metadata.gz: 349d5f579b16c8033a9d0b17a7db317f3d9918246a487618cc3c95ea4201018837a901180fecad9cabc4bb9f09dbf23e3829e9f3b95b11ca4588058d4d3834d3
7
- data.tar.gz: f3e7f8332d13f5e807b5704d2c8f24bf28e278bed24da1603dc22b5b22563b756faf66ba0a7d33f36161fef12a8128ec4074378fe623d967111389809912faa4
6
+ metadata.gz: 50afc3a5dea7af42cd9c3aa2d5529f4e36dff23cd553199fe424617c4478baa45ebca1554db1390563b253b0102659dd473029f344e090e16c959473e5ec5161
7
+ data.tar.gz: 95ea11c6c51596d461cc56249e2298044c10fa78f2469747f22da9a6da3506531ed62add6e11fe4aa97c344e79a7f782151e6328c805b4dcd9ce90aab246b05e
@@ -34,7 +34,7 @@ module Trusty
34
34
 
35
35
  def build_record(additional_attributes = {}, options = {})
36
36
  build_relation = (options[:relation] || relation)
37
- build_relation.build(attributes.merge(required_criteria).merge(additional_attributes), without_protection: true)
37
+ build_relation.build(attributes.merge(required_criteria).merge(additional_attributes))
38
38
  end
39
39
 
40
40
  def find_records(additional_criteria = {})
@@ -68,6 +68,8 @@ module Trusty
68
68
  elsif prepared_relation.respond_to? :metadata
69
69
  # Mongoid
70
70
  prepared_relation.metadata.klass
71
+ else
72
+ prepared_model
71
73
  end
72
74
 
73
75
  prepared_relation ||= if prepared_model.respond_to? :default_scoped
@@ -76,6 +78,8 @@ module Trusty
76
78
  elsif prepared_model.respond_to? :default_scope
77
79
  # Mongoid
78
80
  prepared_model.default_scope
81
+ else
82
+ prepared_relation
79
83
  end
80
84
 
81
85
  prepared_column_names = if prepared_model.respond_to? :column_names
@@ -11,13 +11,13 @@ module Trusty
11
11
 
12
12
  # provider_attributes = OmniAuth data
13
13
  # options =
14
- # - :user_model = User model
14
+ # - :user_model = User model class
15
15
  # - :user_relation = Relation to create new User on (optional, to call #build method on)
16
16
  # - :user_attributes = Hash of attributes to merge into user_attributes
17
17
  # - :user_attributes_names = Array of attribute names to copy from Omniauth data (default: User.column_names)
18
18
  # - :user_required_criteria = Hash of criteria to use to find users, and also to merge into attributes
19
19
  # - :user_identifiers = Array of column names that identify a model uniquely with omniauth data
20
- # - :identity_model = Identity model
20
+ # - :identity_model = Identity model class
21
21
  # - :identity_attributes = Hash of attributes to merge into identity_attributes
22
22
  # - :identity_attribute_names = Array of attribute names to copy from Omniauth data (default: Identity.column_names)
23
23
  # - :identity_required_criteria = Hash of criteria to use to find identities, and also to merge into attributes
@@ -35,14 +35,15 @@ module Trusty
35
35
  }.merge(options)
36
36
 
37
37
  @provider_identity = ModelMapper.new(self,
38
- :model => @options[:identity_model] || ::Identity,
38
+ :model => @options[:identity_model],
39
+ :relation => @options[:identity_relation],
39
40
  :attributes => @options[:identity_attributes],
40
41
  :attribute_names => @options[:identity_attribute_names],
41
42
  :unique_identifiers => @options[:identity_identifiers] || [:provider, :uid],
42
43
  :required_criteria => @options[:identity_required_criteria]
43
44
  )
44
45
  @provider_user = ModelMapper.new(self,
45
- :model => @options[:user_model] || ::User,
46
+ :model => @options[:user_model],
46
47
  :relation => @options[:user_relation],
47
48
  :attributes => @options[:user_attributes],
48
49
  :attribute_names => @options[:user_attribute_names],
@@ -1,3 +1,3 @@
1
1
  module Trusty
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Van Horn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler