mongoid 5.0.0.rc0 → 5.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54ef20325b3cd2e53ac0f9f3ab587fdef250af88
4
- data.tar.gz: 3a2230b51c21767e0d0255f83b0d26cfd016585c
3
+ metadata.gz: add22f9a2555b543be72f205bad6bc0baa3f00c5
4
+ data.tar.gz: e5e3472e31f1f826a4ad7cd0e2607aeef72a4adc
5
5
  SHA512:
6
- metadata.gz: d5922a0735e4a5245b095e28abd81ebed7513169a0586dfc8b137cb645adce577d202f2928746f2d87c0cf4f384928dfbd2e3f93402e21cafc88f0a9bfb4c178
7
- data.tar.gz: 6b8aef5ac85b8715ee9106bc018ca2abda954766b8277e98d6e9a7134e6986d5645c83291b4ee520cf294687816d0c52cd0ddebae7a51e1ee31341b6f13d175b
6
+ metadata.gz: 6349535d149183db9330fa3469e8ad25a119e3bb78545046f0cf44e1de7c75be8ca3f1785aeb387856d2ab7d50e079a17dc3328c3a8fe4d26cf1332923a3a994
7
+ data.tar.gz: 78fecf90c0308eb831ace2022c9acd4ac817b3b4080332a8207c31db0aeafd1d683b4ce30257e99bfe20e1745215d9789d6c88e5a99c05e847d76f77e5f429f9
@@ -20,7 +20,7 @@ module Mongoid
20
20
  # Define a configuration option with a default.
21
21
  #
22
22
  # @example Define the option.
23
- # Options.option(:persist_in_safe_mode, :default => true)
23
+ # Options.option(:logger, :default => Logger.new($stdout, :warn))
24
24
  #
25
25
  # @param [ Symbol ] name The name of the configuration option.
26
26
  # @param [ Hash ] options Extras for the option.
@@ -7,6 +7,8 @@ module Mongoid
7
7
  # translating the messages.
8
8
  class MongoidError < StandardError
9
9
 
10
+ attr_reader :problem, :summary, :resolution
11
+
10
12
  BASE_KEY = "mongoid.errors.messages"
11
13
 
12
14
  # Compose the message.
@@ -18,9 +20,9 @@ module Mongoid
18
20
  #
19
21
  # @since 3.0.0
20
22
  def compose_message(key, attributes)
21
- @problem = problem(key, attributes)
22
- @summary = summary(key, attributes)
23
- @resolution = resolution(key, attributes)
23
+ @problem = translate_problem(key, attributes)
24
+ @summary = translate_summary(key, attributes)
25
+ @resolution = translate_resolution(key, attributes)
24
26
  @problem_title = translate("message_title", {})
25
27
  @summary_title = translate("summary_title", {})
26
28
  @resolution_title = translate("resolution_title", {})
@@ -58,7 +60,7 @@ module Mongoid
58
60
  # @return [ String ] The problem.
59
61
  #
60
62
  # @since 3.0.0
61
- def problem(key, attributes)
63
+ def translate_problem(key, attributes)
62
64
  translate("#{key}.message", attributes)
63
65
  end
64
66
 
@@ -73,7 +75,7 @@ module Mongoid
73
75
  # @return [ String ] The summary.
74
76
  #
75
77
  # @since 3.0.0
76
- def summary(key, attributes)
78
+ def translate_summary(key, attributes)
77
79
  translate("#{key}.summary", attributes)
78
80
  end
79
81
 
@@ -88,7 +90,7 @@ module Mongoid
88
90
  # @return [ String ] The resolution.
89
91
  #
90
92
  # @since 3.0.0
91
- def resolution(key, attributes)
93
+ def translate_resolution(key, attributes)
92
94
  translate("#{key}.resolution", attributes)
93
95
  end
94
96
  end
@@ -42,7 +42,6 @@ module Rails
42
42
  # module MyApplication
43
43
  # class Application < Rails::Application
44
44
  # config.mongoid.logger = Logger.new($stdout, :warn)
45
- # config.mongoid.persist_in_safe_mode = true
46
45
  # end
47
46
  # end
48
47
  #
@@ -20,8 +20,9 @@ module Mongoid
20
20
  binding do
21
21
  inverse_keys = doc.you_must(metadata.inverse_foreign_key)
22
22
  if inverse_keys
23
- unless inverse_keys.include?(inverse_record_id(doc))
24
- inverse_keys.push(inverse_record_id(doc))
23
+ record_id = inverse_record_id(doc)
24
+ unless inverse_keys.include?(record_id)
25
+ doc.you_must(metadata.inverse_foreign_key_setter, inverse_keys.push(record_id))
25
26
  end
26
27
  doc.reset_relation_criteria(metadata.inverse)
27
28
  end
@@ -459,6 +459,20 @@ module Mongoid
459
459
  @inverse_foreign_key ||= determine_inverse_foreign_key
460
460
  end
461
461
 
462
+ # Used for relational many to many only. This determines the name of the
463
+ # foreign key field setter on the inverse side of the relation, since in this
464
+ # case there are keys on both sides.
465
+ #
466
+ # @example Find the inverse foreign key setter.
467
+ # metadata.inverse_foreign_key_setter
468
+ #
469
+ # @return [ String ] The foreign key setter on the inverse.
470
+ #
471
+ # @since 2.0.0.rc.1
472
+ def inverse_foreign_key_setter
473
+ @inverse_foreign_key_setter ||= "#{inverse_foreign_key}="
474
+ end
475
+
462
476
  # Returns the inverse class of the proxied relation.
463
477
  #
464
478
  # @example Get the inverse class.
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid
3
- VERSION = "5.0.0.rc0"
3
+ VERSION = "5.0.0"
4
4
  end
@@ -9,7 +9,7 @@ test:
9
9
  password: "password"
10
10
  auth_source: "admin"
11
11
  read:
12
- mode: primary
12
+ mode: :primary
13
13
  max_pool_size: 1
14
14
  options:
15
15
  include_root_in_json: false
@@ -197,7 +197,7 @@ describe Mongoid::Config do
197
197
  end
198
198
 
199
199
  it "sets the read option" do
200
- expect(options["read"]).to eq({ "mode" => "primary" })
200
+ expect(options["read"]).to eq({ "mode" => :primary })
201
201
  end
202
202
  end
203
203
  end
@@ -23,15 +23,15 @@ describe Mongoid::Errors::MongoidError do
23
23
  describe "#compose_message" do
24
24
 
25
25
  it "sets ivar problem" do
26
- expect(error.instance_variable_get(:@problem)).to be
26
+ expect(error.problem).to be
27
27
  end
28
28
 
29
29
  it "sets ivar summary" do
30
- expect(error.instance_variable_get(:@summary)).to be
30
+ expect(error.summary).to be
31
31
  end
32
32
 
33
33
  it "sets ivar resolution" do
34
- expect(error.instance_variable_get(:@resolution)).to be
34
+ expect(error.resolution).to be
35
35
  end
36
36
 
37
37
  it "sets ivar problem_title" do
@@ -68,7 +68,7 @@ CONFIG = {
68
68
  heartbeat_frequency: 180,
69
69
  user: MONGOID_ROOT_USER.name,
70
70
  password: MONGOID_ROOT_USER.password,
71
- auth_source: Mongo::Database::ADMIN
71
+ auth_source: Mongo::Database::ADMIN,
72
72
  }
73
73
  }
74
74
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-24 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: mongo
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.1.0.rc0
47
+ version: '2.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.1.0.rc0
54
+ version: '2.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: origin
57
57
  requirement: !ruby/object:Gem::Requirement