dimarzio-model_translations 0.1.0 → 0.1.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/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 [name of plugin creator]
1
+ Copyright (c) 2009 Dmitry Afanasyev
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README CHANGED
@@ -5,10 +5,9 @@ Plugin for translating data of your models.
5
5
 
6
6
  features:
7
7
  * dynamic additions of the languages
8
- * all translations goes in one 'translations' table (version with the child translations tables for each model is in plans)
8
+ * all translations go in one 'translations' table (version with the child translation tables for each model is in plans)
9
9
 
10
- Currently it uses language locale set for to retrieve and set data.
11
- It uses I18n.locale to set and retrieve data.
10
+ Now it uses current locale to retrieve and set data.
12
11
  Currently there is no way to dynamically switch the language except set I18n.locale (will be done in the future version).
13
12
 
14
13
  Example
@@ -21,8 +20,52 @@ class Post < ActiveRecord::Base
21
20
  :content
22
21
  end
23
22
 
23
+ Don't create attributes to translate in the migration - it will not be used.
24
24
 
25
- Example goes here.
25
+
26
+ Install
27
+ =======
28
+
29
+ To install the plugin as gem add the following lines to your environment.rb
30
+
31
+ config.gem 'dimarzio-model_translations',
32
+ :lib => 'model_translations',
33
+ :source => 'http://gems.github.com'
34
+
35
+ and while I ain't created the generator (it will be done soon) you should add the following migration and model to your app:
36
+
37
+ class CreateTranslations < ActiveRecord::Migration
38
+ def self.up
39
+ create_table :translations do |t|
40
+ t.string :field, :null => false
41
+ t.string :value, :null => false
42
+ t.string :locale, :null => false
43
+ t.references :owner, :polymorphic => true, :null => false
44
+
45
+ t.timestamps
46
+ end
47
+ end
48
+
49
+ def self.down
50
+ drop_table :translations
51
+ end
52
+ end
53
+
54
+ class Translation < ActiveRecord::Base
55
+ belongs_to :owner,
56
+ :polymorphic => true
57
+
58
+ validates_presence_of :field,
59
+ :value,
60
+ :locale,
61
+ :owner_id,
62
+ :owner_type
63
+
64
+ end
65
+
66
+
67
+
68
+ The suggestions and/or pull requests are all welcome!
26
69
 
27
70
 
28
- Copyright (c) 2009 Dmitry Afansyev, released under the MIT license
71
+ Copyright (c) 2009 Dmitry Afanasyev, released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{model_translations}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dmitry Afanasyev"]
12
- s.date = %q{2009-08-16}
12
+ s.date = %q{2009-08-17}
13
13
  s.description = %q{Rails plugin for translating data of your models.}
14
14
  s.email = %q{dimarzio1986@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimarzio-model_translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Afanasyev
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-16 00:00:00 -07:00
12
+ date: 2009-08-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency