mongoid_translate 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0b4a98762352bc9a1baa610fa3f0eaf811d32850
4
+ data.tar.gz: 02e54081981f91e67bc8b0a0245410fc693906fa
5
+ SHA512:
6
+ metadata.gz: 623995e94c2d6f13db487992105c9036f6b1901e35fee76b8b6356cb89ccbb0be51d407ad10f1e31f766b4c6c91727f1b7fc5d815a8e812b10297a6c4e762d7f
7
+ data.tar.gz: 68d88af09506f7df7056667863b5c4f400165b2e0d81f71b01f2d1073a9f9bc9c9f242d7958a76a40a684c102ab47fc31469936f899372b8997bbaddee47885a
@@ -1,4 +1,4 @@
1
- Copyright 2011 YOURNAME
1
+ Copyright 2011 af83
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.md CHANGED
@@ -11,7 +11,7 @@ Install it with rubygems:
11
11
  With bundler, add it to your `Gemfile`:
12
12
 
13
13
  ``` ruby
14
- gem "mongoid_translate", "~>0.1.0"
14
+ gem "mongoid_translate", "~>1.0.0"
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -106,8 +106,46 @@ class Translation::Article
106
106
  end
107
107
  ```
108
108
 
109
+ # Examples
110
+
111
+ Controller with InheritedResources
112
+ ----------------------------------
113
+
114
+ ``` ruby
115
+ before_filter :build_translations, only: :edit
116
+ before_filter :build_translations_for_new, only: :new
117
+
118
+ def build_translations
119
+ (I18n.available_locales - resource.languages).each do |language|
120
+ resource.translations.build(language: language)
121
+ end
122
+ end
123
+
124
+ def build_translations_for_new
125
+ (I18n.available_locales - build_resource.languages).each do |language|
126
+ build_resource.translations.build(language: language)
127
+ end
128
+ end
129
+ ```
130
+
131
+ Use slug on views with to_slug
132
+ ------------------------------
133
+
134
+ ``` ruby
135
+ = link_to e.title, event_path(e.to_slug)
136
+ ```
137
+
138
+ Use by_slug in controller with InheritedResources
139
+ -------------------------------------------------
140
+
141
+ ``` ruby
142
+ def resource
143
+ @event ||= Event.by_slug(params[:id]).one || Event.find(params[:id])
144
+ end
145
+ ```
146
+
109
147
  ## Copyright
110
148
 
111
- Copyright (c) 2012 af83
149
+ Copyright (c) 2011-2013 af83
112
150
 
113
151
  Released under the MIT license
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid
3
3
  module Translate
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - chatgris
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-10-17 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activesupport
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: mongoid
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ~>
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ~>
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rspec
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ~>
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ~>
61
54
  - !ruby/object:Gem::Version
@@ -76,26 +69,25 @@ files:
76
69
  - lib/mongoid_translate.rb
77
70
  homepage: https://github.com/AF83/mongoid_translate
78
71
  licenses: []
72
+ metadata: {}
79
73
  post_install_message:
80
74
  rdoc_options: []
81
75
  require_paths:
82
76
  - lib
83
77
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
78
  requirements:
86
- - - ! '>='
79
+ - - '>='
87
80
  - !ruby/object:Gem::Version
88
81
  version: '0'
89
82
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
83
  requirements:
92
- - - ! '>='
84
+ - - '>='
93
85
  - !ruby/object:Gem::Version
94
86
  version: '0'
95
87
  requirements: []
96
88
  rubyforge_project:
97
- rubygems_version: 1.8.24
89
+ rubygems_version: 2.0.0
98
90
  signing_key:
99
- specification_version: 3
91
+ specification_version: 4
100
92
  summary: Translate mongoid models.
101
93
  test_files: []