phony_rails 0.4.0 → 0.4.1

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.
data/README.md CHANGED
@@ -110,7 +110,7 @@ Say you want to find a record by a phone number. Best is to normalize user input
110
110
 
111
111
  ## Changelog
112
112
 
113
- 0.4.0
113
+ 0.4.0/0.4.1
114
114
  * Better Mongoid support by @johnnyshields
115
115
 
116
116
  0.3.0
@@ -1,9 +1,4 @@
1
1
  en:
2
- activerecord:
3
- errors:
4
- messages:
5
- improbable_phone: "is an invalid number"
6
- activemodel:
7
- errors:
8
- messages:
9
- improbable_phone: "is an invalid number"
2
+ errors:
3
+ messages:
4
+ improbable_phone: "is an invalid number"
@@ -1,5 +1,4 @@
1
1
  fr:
2
- activerecord:
3
- errors:
4
- messages:
5
- improbable_phone: "est un numéro invalide"
2
+ errors:
3
+ messages:
4
+ improbable_phone: "est un numéro invalide"
@@ -0,0 +1,4 @@
1
+ ja:
2
+ errors:
3
+ messages:
4
+ improbable_phone: "は正し電話番号ではありません"
@@ -1,3 +1,3 @@
1
1
  module PhonyRails
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/phony_rails.rb CHANGED
@@ -50,7 +50,7 @@ module PhonyRails
50
50
  attributes.each do |attribute|
51
51
  attribute_name = options[:as] || attribute
52
52
  raise RuntimeError, "No attribute #{attribute_name} found on #{self.class.name} (PhonyRails)" if not self.class.attribute_method?(attribute_name)
53
- write_attribute(attribute_name, PhonyRails.normalize_number(read_attribute(attribute), options))
53
+ self.send("#{attribute_name}=", PhonyRails.normalize_number(self.send(attribute), options))
54
54
  end
55
55
  end
56
56
  end
@@ -111,7 +111,7 @@ describe PhonyPlausibleValidator do
111
111
  @home.errors.messages.should include(:phone_number => ["is an invalid number"])
112
112
  end
113
113
 
114
- it "should translate the error message in english" do
114
+ it "should translate the error message in English" do
115
115
  I18n.with_locale(:en) do
116
116
  @home.phone_number = INVALID_NUMBER
117
117
  @home.valid?
@@ -119,7 +119,7 @@ describe PhonyPlausibleValidator do
119
119
  end
120
120
  end
121
121
 
122
- it "should translate the error message in french" do
122
+ it "should translate the error message in French" do
123
123
  I18n.with_locale(:fr) do
124
124
  @home.phone_number = INVALID_NUMBER
125
125
  @home.valid?
@@ -127,6 +127,13 @@ describe PhonyPlausibleValidator do
127
127
  end
128
128
  end
129
129
 
130
+ it "should translate the error message in Japanese" do
131
+ I18n.with_locale(:ja) do
132
+ @home.phone_number = INVALID_NUMBER
133
+ @home.valid?
134
+ @home.errors.messages.should include(:phone_number => ["は正し電話番号ではありません"])
135
+ end
136
+ end
130
137
  end
131
138
  end
132
139
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
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: 2013-06-25 00:00:00.000000000 Z
12
+ date: 2013-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: phony
@@ -110,6 +110,7 @@ files:
110
110
  - lib/phony_rails.rb
111
111
  - lib/phony_rails/locales/en.yml
112
112
  - lib/phony_rails/locales/fr.yml
113
+ - lib/phony_rails/locales/ja.yml
113
114
  - lib/phony_rails/string_extensions.rb
114
115
  - lib/phony_rails/version.rb
115
116
  - lib/validators/phony_validator.rb