embedded_localization 0.2.0 → 0.2.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.textile CHANGED
@@ -56,7 +56,7 @@ h3. Rails 3.0
56
56
  class CreateGenres < ActiveRecord::Migration
57
57
  def self.up
58
58
  create_table :genres do |t|
59
- t.text :i18n # stores the translated attributes; persisted as a HashWithIndifferentAccess
59
+ t.text :i18n # stores the translated attributes; persisted as a Hash
60
60
 
61
61
  # optional:
62
62
  # t.string :name # you CAN define :name as a real column in your DB (but you don't have to)
@@ -205,11 +205,13 @@ If your requirements are different, my approach might not work for you. In that
205
205
 
206
206
  h2. Changes
207
207
 
208
+ h3. 0.2.0 (2012-01-31)
209
+ * added support for having DB columns for translated attributes, to enable SQL queries in I18n.default_locale
210
+
208
211
  h3. 0.1.4 (2012-01-31)
209
212
  * fixed bug with dirty tracking of serialized i18n attribute
210
213
  * renamed #fallback? to #fallbacks?
211
214
 
212
-
213
215
  h3. 0.1.3 Initial Version (2012-01-27)
214
216
 
215
217
 
@@ -71,8 +71,8 @@ module EmbeddedLocalization
71
71
  if self.attributes.has_key?(attr_name.to_s) # if user has defined DB field with that name
72
72
  write_attribute(attr_name , new_translation) if I18n.locale == I18n.default_locale
73
73
  end
74
- self.i18n[I18n.locale] ||= HashWithIndifferentAccess.new
75
- self.i18n[I18n.locale][attr_name] = new_translation
74
+ self.i18n[I18n.locale] ||= Hash.new
75
+ self.i18n[I18n.locale][attr_name.to_sym] = new_translation
76
76
  end
77
77
  end
78
78
  end
@@ -21,8 +21,8 @@ module EmbeddedLocalization
21
21
  if self.attributes.has_key?(attr_name.to_s) # if user has defined DB field with that name
22
22
  write_attribute(attr_name , new_translation) if locale == I18n.default_locale
23
23
  end
24
- self.i18n[locale] ||= HashWithIndifferentAccess.new
25
- self.i18n[locale][attr_name] = new_translation
24
+ self.i18n[locale] ||= Hash.new
25
+ self.i18n[locale][attr_name.to_sym] = new_translation
26
26
  end
27
27
 
28
28
  # Returns all locales used for translation of all documents of this class.
@@ -96,10 +96,10 @@ module EmbeddedLocalization
96
96
  # initialized the serialized 'i18n' attribute with Hash of Hashes,
97
97
  # containing all pre-defined translated attributes with nil value
98
98
  def initialize_i18n_hashes
99
- self.i18n ||= HashWithIndifferentAccess.new
100
- self.i18n[ I18n.locale ] ||= HashWithIndifferentAccess.new(Hash.zip(translated_attribute_names,[]))
99
+ self.i18n ||= Hash.new
100
+ self.i18n[ I18n.locale ] ||= Hash.new(Hash.zip(translated_attribute_names,[]))
101
101
  if I18n.locale != I18n.default_locale
102
- self.i18n[ I18n.default_locale ] ||= HashWithIndifferentAccess.new(Hash.zip(translated_attribute_names,[]))
102
+ self.i18n[ I18n.default_locale ] ||= Hash.new(Hash.zip(translated_attribute_names,[]))
103
103
  end
104
104
  end
105
105
 
@@ -1,3 +1,3 @@
1
1
  module EmbeddedLocalization
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: embedded_localization
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tilo Sloboda
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-31 00:00:00 Z
13
+ date: 2012-02-01 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: "Rails I18n: Embedded_Localization for ActiveRecord 3 is very lightweight, and allows you to transparently store translations of attributes right inside each record -- no extra database tables needed to store the localization data!"