mongoid 2.0.0.beta.16 → 2.0.0.beta.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,65 @@
1
+ kr:
2
+ activemodel:
3
+ errors:
4
+ messages:
5
+ taken: 이미 사용하고있습니다 #is already taken
6
+
7
+ mongoid:
8
+ errors:
9
+ messages:
10
+ document_not_found:
11
+ 클라스 %{klass}와 id를 %{identifiers} 위한 문서를 찾을수 없습니다.
12
+ #Document not found for class %{klass} with id(s) %{identifiers}.
13
+
14
+ invalid_database:
15
+ 데이타베이스가 Mongo::DB이어야 합니다, %{name}이면 안됩니다.
16
+ #Database should be a Mongo::DB, not %{name}.
17
+
18
+ invalid_type:
19
+ 데이터 필드가 %{klass} 처럼 정의를 내립니다. 하지만 그것은 %{other}를 %{value} 으로 산출되어 받습니다
20
+ #Field was defined as a(n) %{klass}, but received a %{other} with
21
+ #the value %{value}.
22
+
23
+ unsupported_version:
24
+ MongoDB %{version} 를 사용할수 없습니다. %{mongo_version} 으로 업그레이드 시켜주세요.
25
+ #MongoDB %{version} not supported, please upgrade
26
+ #to %{mongo_version}.
27
+
28
+ validations:
29
+ 확인할수 없습니다 - %{errors}.
30
+ #Validation failed - %{errors}.
31
+
32
+ invalid_collection:
33
+ %{klass} 를 위한 콜렉션에 접근하는것은 임베디드 문서이게 때문에 허락되지 않습니다. 루트 문서에서 콜렉션을 접근해 주세요
34
+ #Access to the collection for %{klass} is not allowed since it
35
+ #is an embedded document, please access a collection from
36
+ #the root document.
37
+
38
+ invalid_field:
39
+ 필드의 정의를 %{name}으로 이름짓는것은 허락되지 않습니다.
40
+ Mongoid 내부의 속성과 메서드이름이 충돌이 되므로 필드의 정의를 내리지 마세요.
41
+ 어떤이름이 포함되는지 보려면 Document#instance_methods를 사용하세요.
42
+ #Defining a field named %{name} is not allowed. Do not define
43
+ #fields that conflict with Mongoid internal attributes or method
44
+ #names. Use Document#instance_methods to see what names this includes.
45
+
46
+ too_many_nested_attribute_records:
47
+ %{association} 을 위한 내부의 속성을 수용하는것은 %{limit}데이터로 제한되어있습니다.
48
+ #Accepting nested attributes for %{association} is limited
49
+ #to %{limit} records.
50
+
51
+ embedded_in_must_have_inverse_of:
52
+ embedded_in 관련되는 옵션은 inverse_of 를 포함해야만 합니다.
53
+ #Options for embedded_in association must include inverse_of.
54
+
55
+ dependent_only_references_one_or_many:
56
+ 공급되는 dependent => destroy|delete 옵션은 오직 references_one 또는 references_many 관련되는것에서만 확인 가능합니다.
57
+ #The dependent => destroy|delete option that was supplied
58
+ #is only valid on references_one or references_many associations.
59
+
60
+ association_cant_have_inverse_of:
61
+ 이관련된것에서 inverse_of 처럼 정의내리는것은 허락되지 않습니다.
62
+ 오직 embedded_in 에있는 옵션 또는 array된 references_many 옵션을 사용하세요
63
+ #Defining an inverse_of on this association is not allowed. Only
64
+ #use this option on embedded_in or references_many as array.
65
+
@@ -0,0 +1,40 @@
1
+ pt-br:
2
+ activemodel:
3
+ errors:
4
+ messages:
5
+ taken: já está utilizada
6
+
7
+ mongoid:
8
+ errors:
9
+ messages:
10
+ document_not_found:
11
+ Nenhum documento encontrado para a classe %{klass} com os id(s) %{identifiers}.
12
+ invalid_database:
13
+ A base de dados deverá ser uma Mongo::DB, em vez de %{name}.
14
+ invalid_type:
15
+ O campo foi definido como %{klass}, mas recebeu uma instância de %{other} com
16
+ o valor %{value}.
17
+ unsupported_version:
18
+ MongoDB %{version} não é suportada, por favor atualize para a
19
+ versão %{mongo_version}.
20
+ validations:
21
+ A validação falhou - %{errors}.
22
+ invalid_collection:
23
+ O acesso à colecção para %{klass} não é permitido porque
24
+ é um documento embutido, por favor acesse à colecção através
25
+ do documento raiz.
26
+ invalid_field:
27
+ Não é permitido definir um campo com o nome %{name}. Não defina
28
+ campos que entrem em conflito com os nomes dos atributos internos e métodos
29
+ do Mongoid. Use Document#instance_methods para consultar esses nomes.
30
+ too_many_nested_attribute_records:
31
+ A aceitação de atributos encadeados para %{association} encontra-se limitada
32
+ a %{limit} registros.
33
+ embedded_in_must_have_inverse_of:
34
+ As opções para uma associação embedded_in devem incluir inverse_of.
35
+ dependent_only_references_one_or_many:
36
+ A opção The dependent => destroy|delete que é fornecida
37
+ é apenas válida para associações references_one ou references_many.
38
+ association_cant_have_inverse_of:
39
+ A definição de inverse_of nesta associação não é permitida. Apenas
40
+ use esta opção em embedded_in ou references_many as array.
@@ -29,7 +29,7 @@ pt:
29
29
  do Mongoid. Use Document#instance_methods para consultar esses nomes.
30
30
  too_many_nested_attribute_records:
31
31
  A aceitação de atributos encadeados para %{association} encontra-se limitada
32
- a %{limit} registos.
32
+ a %{limit} registros.
33
33
  embedded_in_must_have_inverse_of:
34
34
  As opções para uma associação embedded_in devem incluir inverse_of.
35
35
  dependent_only_references_one_or_many:
@@ -30,8 +30,8 @@ module Mongoid #:nodoc:
30
30
  end
31
31
 
32
32
  # Override respond_to? so it responds properly for dynamic attributes
33
- def respond_to?(sym)
34
- (Mongoid.allow_dynamic_fields && @attributes && @attributes.has_key?(sym.to_s)) || super
33
+ def respond_to?(*args)
34
+ (Mongoid.allow_dynamic_fields && @attributes && @attributes.has_key?(args.first.to_s)) || super
35
35
  end
36
36
 
37
37
  # Process the provided attributes casting them to their proper values if a
@@ -73,6 +73,7 @@ module Mongoid #:nodoc:
73
73
  typed_value = fields.has_key?(access) ? fields[access].get(value) : value
74
74
  accessed(access, typed_value)
75
75
  end
76
+ alias :[] :read_attribute
76
77
 
77
78
  # Remove a value from the +Document+ attributes. If the value does not exist
78
79
  # it will fail gracefully.
@@ -131,6 +132,7 @@ module Mongoid #:nodoc:
131
132
  modify(access, @attributes[access], typed_value_for(access, value))
132
133
  notify if !id.blank? && new_record?
133
134
  end
135
+ alias :[]= :write_attribute
134
136
 
135
137
  # Writes the supplied attributes +Hash+ to the +Document+. This will only
136
138
  # overwrite existing attributes if they are present in the new +Hash+, all
@@ -162,11 +162,11 @@ module Mongoid #:nodoc
162
162
  #
163
163
  # <tt>Mongoid::Config.instance.from_hash({})</tt>
164
164
  def from_hash(settings)
165
- _master(settings)
166
- _slaves(settings)
167
165
  settings.except("database", "slaves").each_pair do |name, value|
168
166
  send("#{name}=", value) if respond_to?("#{name}=")
169
167
  end
168
+ _master(settings)
169
+ _slaves(settings)
170
170
  end
171
171
 
172
172
  # Adds a new I18n locale file to the load path
@@ -59,7 +59,8 @@ module Mongoid #:nodoc:
59
59
  # Returns: <tt>self</tt>
60
60
  def any_of(*args)
61
61
  criterion = @selector["$or"] || []
62
- @selector["$or"] = criterion.concat(args)
62
+ expanded = args.collect(&:expand_complex_criteria)
63
+ @selector["$or"] = criterion.concat(expanded)
63
64
  self
64
65
  end
65
66
  alias :or :any_of
@@ -44,7 +44,7 @@ module Mongoid #:nodoc:
44
44
  when Regexp
45
45
  value
46
46
  else
47
- field.set(value)
47
+ field.type == Array ? value.class.set(value) : field.set(value)
48
48
  end
49
49
  end
50
50
 
@@ -20,7 +20,7 @@ module Mongoid #:nodoc
20
20
  #
21
21
  # A localized error message string.
22
22
  def translate(key, options)
23
- I18n.translate("#{BASE_KEY}.#{key}", options)
23
+ ::I18n.translate("#{BASE_KEY}.#{key}", options)
24
24
  end
25
25
  end
26
26
  end
@@ -65,7 +65,7 @@ module Rails #:nodoc:
65
65
  rescue ::Mongoid::Errors::InvalidDatabase => e
66
66
  unless Rails.root.join("config", "mongoid.yml").file?
67
67
  puts "\nMongoid config not found. Create a config file at: config/mongoid.yml"
68
- puts "to generate one run: script/rails generate mongoid:config\n\n"
68
+ puts "to generate one run: rails generate mongoid:config\n\n"
69
69
  end
70
70
  end
71
71
  end
@@ -12,13 +12,13 @@ module Mongoid #:nodoc:
12
12
  # Example:
13
13
  #
14
14
  # <tt>person.safely.upsert</tt>
15
- # <tt>person.safely.destroy</tt>
15
+ # <tt>person.safely(:w => 2, :fsync => true).destroy</tt>
16
16
  #
17
17
  # Returns:
18
18
  #
19
19
  # A +Proxy+ to the +Document+.
20
- def safely
21
- Proxy.new(self)
20
+ def safely(safety = true)
21
+ Proxy.new(self, safety)
22
22
  end
23
23
 
24
24
  module ClassMethods #:nodoc:
@@ -28,13 +28,13 @@ module Mongoid #:nodoc:
28
28
  # Example:
29
29
  #
30
30
  # <tt>Person.safely.create(:name => "John")</tt>
31
- # <tt>Person.safely.delete_all</tt>
31
+ # <tt>Person.safely(:w => 2, :fsync => true).delete_all</tt>
32
32
  #
33
33
  # Returns:
34
34
  #
35
35
  # A +Proxy+ to the +Document+ class.
36
- def safely
37
- Proxy.new(self)
36
+ def safely(safety = true)
37
+ Proxy.new(self, safety)
38
38
  end
39
39
  end
40
40
 
@@ -48,15 +48,17 @@ module Mongoid #:nodoc:
48
48
  # not safe mode is allowed.
49
49
  class Proxy
50
50
 
51
- attr_reader :target
51
+ attr_reader :target, :safety_options
52
52
 
53
53
  # Create the new +Proxy+.
54
54
  #
55
55
  # Options:
56
56
  #
57
57
  # target: Either the class or the instance.
58
- def initialize(target)
58
+ # safety_options: true or a hash of options
59
+ def initialize(target, safety_options)
59
60
  @target = target
61
+ @safety_options = safety_options
60
62
  end
61
63
 
62
64
  # We will use method missing to proxy calls to the target.
@@ -67,7 +69,7 @@ module Mongoid #:nodoc:
67
69
  def method_missing(*args)
68
70
  name = args[0]
69
71
  attributes = args[1] || {}
70
- @target.send(name, attributes.merge(:safe => true))
72
+ @target.send(name, attributes.merge(:safe => safety_options))
71
73
  end
72
74
 
73
75
  # Increment the field by the provided value, else if it doesn't exists set
@@ -79,7 +81,7 @@ module Mongoid #:nodoc:
79
81
  # value: The value to increment by.
80
82
  # options: Options to pass through to the driver.
81
83
  def inc(field, value, options = {})
82
- @target.inc(field, value, :safe => true)
84
+ @target.inc(field, value, :safe => safety_options)
83
85
  end
84
86
 
85
87
  # Update the +Document+ attributes in the datbase.
@@ -93,7 +95,7 @@ module Mongoid #:nodoc:
93
95
  # +true+ if validation passed, +false+ if not.
94
96
  def update_attributes(attributes = {})
95
97
  @target.write_attributes(attributes)
96
- @target.update(:safe => true)
98
+ @target.update(:safe => safety_options)
97
99
  end
98
100
 
99
101
  # Update the +Document+ attributes in the datbase.
@@ -107,7 +109,7 @@ module Mongoid #:nodoc:
107
109
  # +true+ if validation passed, raises an error if not
108
110
  def update_attributes!(attributes = {})
109
111
  @target.write_attributes(attributes)
110
- result = update(:safe => true)
112
+ result = update(:safe => safety_options)
111
113
  @target.class.fail_validate!(self) unless result
112
114
  result
113
115
  end
@@ -122,7 +124,7 @@ module Mongoid #:nodoc:
122
124
  #
123
125
  # Returns: the +Document+.
124
126
  def create(attributes = {})
125
- @target.new(attributes).tap { |doc| doc.insert(:safe => true) }
127
+ @target.new(attributes).tap { |doc| doc.insert(:safe => safety_options) }
126
128
  end
127
129
 
128
130
  # Create a new +Document+. This will instantiate a new document and
@@ -137,7 +139,7 @@ module Mongoid #:nodoc:
137
139
  # Returns: the +Document+.
138
140
  def create!(attributes = {})
139
141
  document = @target.new(attributes)
140
- fail_validate!(document) if document.insert(:safe => true).errors.any?
142
+ fail_validate!(document) if document.insert(:safe => safety_options).errors.any?
141
143
  document
142
144
  end
143
145
 
@@ -154,7 +156,7 @@ module Mongoid #:nodoc:
154
156
  def delete_all(conditions = {})
155
157
  Mongoid::Persistence::RemoveAll.new(
156
158
  @target,
157
- { :validate => false, :safe => true },
159
+ { :validate => false, :safe => safety_options },
158
160
  conditions[:conditions] || {}
159
161
  ).persist
160
162
  end
@@ -172,7 +174,7 @@ module Mongoid #:nodoc:
172
174
  def destroy_all(conditions = {})
173
175
  documents = @target.all(conditions)
174
176
  count = documents.count
175
- documents.each { |doc| doc.destroy(:safe => true) }
177
+ documents.each { |doc| doc.destroy(:safe => safety_options) }
176
178
  count
177
179
  end
178
180
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
- VERSION = "2.0.0.beta.16"
3
+ VERSION = "2.0.0.beta.17"
4
4
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 16
11
- version: 2.0.0.beta.16
10
+ - 17
11
+ version: 2.0.0.beta.17
12
12
  platform: ruby
13
13
  authors:
14
14
  - Durran Jordan
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-08-06 00:00:00 -04:00
19
+ date: 2010-08-30 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,13 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - "="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  segments:
30
30
  - 3
31
31
  - 0
32
32
  - 0
33
- - rc
34
- version: 3.0.0.rc
33
+ version: 3.0.0
35
34
  type: :runtime
36
35
  prerelease: false
37
36
  version_requirements: *id001
@@ -40,7 +39,7 @@ dependencies:
40
39
  requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
- - - "="
42
+ - - ~>
44
43
  - !ruby/object:Gem::Version
45
44
  segments:
46
45
  - 0
@@ -185,7 +184,9 @@ files:
185
184
  - lib/config/locales/es.yml
186
185
  - lib/config/locales/fr.yml
187
186
  - lib/config/locales/it.yml
187
+ - lib/config/locales/kr.yml
188
188
  - lib/config/locales/pl.yml
189
+ - lib/config/locales/pt-br.yml
189
190
  - lib/config/locales/pt.yml
190
191
  - lib/config/locales/sv.yml
191
192
  - lib/mongoid/associations/embedded_in.rb
@@ -333,7 +334,7 @@ has_rdoc: true
333
334
  homepage: http://mongoid.org
334
335
  licenses: []
335
336
 
336
- post_install_message: " _________________________________\n |:::::::::::::::::::::::::::::::::| \"I find your lack of faith disturbing.\"\n |:::::::::::::;;::::::::::::::::::|\n |:::::::::::'~||~~~``:::::::::::::| Mongoid 2 introduces\n |::::::::' .': o`:::::::::::| a different way of defining how\n |:::::::' oo | |o o ::::::::::| ids are stored on documents, as\n |::::::: 8 .'.' 8 o :::::::::| well as how foreign key fields\n |::::::: 8 | | 8 :::::::::| and indexes are stored.\n |::::::: _._| |_,...8 :::::::::|\n |::::::'~--. .--. `. `::::::::| If you were using String\n |:::::' =8 ~ \\ o ::::::::| representations of BSON::ObjectIDs\n |::::' 8._ 88. \\ o::::::::| as your document ids, all of your\n |:::' __. ,.ooo~~. \\ o`::::::| documents will now need to tell\n |::: . -. 88`78o/: \\ `:::::| Mongoid to use Strings like so:\n |::' /. o o \\ :: \\88`::::|\n |:; o|| 8 8 |d. `8 `:::| class User\n |:. - ^ ^ -' `-`::| include Mongoid::Document\n |::. .:::| identity :type => String\n |:::::..... ::' ``::| end\n |::::::::-'`- 88 `|\n |:::::-'. - :: | All ids will default to\n |:-~. . . : | BSON:ObjectIDs from now on, and\n | .. . ..: o:8 88o | Config#use_object_ids has been\n |. . ::: 8:P d888. . . | removed.\n |. . :88 88 888' . . |\n | o8 d88P . 88 ' d88P .. | Foreign key fields for relational\n | 88P 888 d8P ' 888 | associations no longer index by\n | 8 d88P.'d:8 .- dP~ o8 | default - you will need to pass\n | 888 888 d~ o888 LS | :index => true to the association\n |_________________________________| definition to have the field indexed\n\n or create the index manually, which is the preferred method. Note that\n if you were using String ids and now want to use object ids instead you\n will have to migrate your database manually - Mongoid cannot perform\n this for you automatically. If you were using custom composite keys,\n these will need to be defined as Strings since they cannot be converted.\n\n You can run a rake task to convert all your string object ids to ObjectID (thanks to Kyle Banker):\n\n rake db:mongoid:objectid_convert\n\n Your old collections will be backed up to their original names appended with \"_old\".\n If you verify your site is still working good with the ObjectIDs, you can clean them up using:\n\n rake db:mongoid:cleanup_old_collections\n\n"
337
+ post_install_message:
337
338
  rdoc_options: []
338
339
 
339
340
  require_paths:
@@ -343,7 +344,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
343
344
  requirements:
344
345
  - - ">="
345
346
  - !ruby/object:Gem::Version
346
- hash: -2440289374354549879
347
+ hash: 408136898212555646
347
348
  segments:
348
349
  - 0
349
350
  version: "0"