rails_dictionary 0.0.9.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -6
- data/lib/rails_dictionary/models/acts_as_dict_slave.rb +7 -1
- data/lib/rails_dictionary/version.rb +1 -1
- data/rails_dictionary.gemspec +3 -0
- metadata +45 -33
data/README.rdoc
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
= Intro
|
2
|
-
There are always some static data(not static page) in application.For example product type or diploma
|
2
|
+
There are always some static data(not static page) in application.For example product type or student diploma type.
|
3
3
|
|
4
4
|
This gem can map these static data to a Dictionary#method like Dictionary#student_diploma_kind and generate a list of instance method on Student like @student.named_city which return city name (with locale if you need).
|
5
5
|
|
6
6
|
= Usage
|
7
7
|
== Installation
|
8
|
+
Version 1.0 support Rails3.1
|
9
|
+
|
8
10
|
Rail3
|
9
11
|
gem 'rails_dictionary'
|
10
12
|
or
|
11
|
-
gem "rails_dictionary"
|
13
|
+
gem "rails_dictionary", :git => 'git://github.com/raykin/rails_dictionary'
|
12
14
|
|
13
|
-
!!For
|
15
|
+
!!For users who update from old version to 0.0.9.1 or higher,Please run following command on app root after updates.
|
14
16
|
rails runner "DictType.new.delete_all_caches"
|
15
17
|
and in production
|
16
18
|
rails runner "DictType.new.delete_all_caches" -e production
|
@@ -39,8 +41,8 @@ These task are just generate table dictionaries,dict_types,students and some sam
|
|
39
41
|
+----+----------+---------+----------+--------------+
|
40
42
|
| id | name_en | name_zh | name_fr | dict_type_id |
|
41
43
|
+----+----------+---------+----------+--------------+
|
42
|
-
|
|
43
|
-
|
|
44
|
+
| 3 | shanghai | 上海 | shanghai | 1 |
|
45
|
+
| 4 | beijing | 北京 | Pékin | 1 |
|
44
46
|
+----+----------+---------+----------+--------------+
|
45
47
|
2 rows in set
|
46
48
|
irb(main):016:0> Student.select("id,email,city,school").all
|
@@ -121,5 +123,6 @@ In short,when you confused with the debug data,try running "rails tmp:clear" fir
|
|
121
123
|
= TODO & Problems
|
122
124
|
Is there any exist low level method to monitor the change of descendents
|
123
125
|
Add test code for cache DictType.tab_and_column,then uncomment the cache code.
|
126
|
+
Remove gems/rails_dictionary-0.0.9.4/app/views from rails view path
|
124
127
|
|
125
|
-
There are no
|
128
|
+
There are no conventions and implemention to map Class like Ckeditor::Asset to a legal method name.
|
@@ -8,7 +8,13 @@ module RailsDictionary
|
|
8
8
|
|
9
9
|
# return columns that exist in DictType#tab_and_column
|
10
10
|
def columns_in_dict_type
|
11
|
-
|
11
|
+
if ActiveRecord::VERSION::STRING < '3.1'
|
12
|
+
DictType.tab_and_column[self.name.underscore.to_sym]
|
13
|
+
elsif DictType.table_exists?
|
14
|
+
DictType.tab_and_column[self.name.underscore.to_sym]
|
15
|
+
else
|
16
|
+
[]
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
# columns which map to dictionary
|
data/rails_dictionary.gemspec
CHANGED
@@ -14,6 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.rubyforge_project = "rails_dictionary"
|
16
16
|
|
17
|
+
s.add_runtime_dependency 'rails', '> 3.0'
|
18
|
+
s.add_development_dependency 'rails', '> 3.0'
|
19
|
+
|
17
20
|
s.files = `git ls-files`.split("\n")
|
18
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,28 +1,46 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_dictionary
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.9.4
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Raykin Lee
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
date: 2011-12-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: &16060860 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>'
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *16060860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rails
|
27
|
+
requirement: &16060200 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>'
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *16060200
|
36
|
+
description: Rails plugin for mapping static data of web application to Dictionary
|
37
|
+
class
|
38
|
+
email:
|
18
39
|
- raykincoldxiao@campus.com
|
19
40
|
executables: []
|
20
|
-
|
21
41
|
extensions: []
|
22
|
-
|
23
42
|
extra_rdoc_files: []
|
24
|
-
|
25
|
-
files:
|
43
|
+
files:
|
26
44
|
- .gitignore
|
27
45
|
- CHANGELOG
|
28
46
|
- Gemfile
|
@@ -45,33 +63,27 @@ files:
|
|
45
63
|
- spec/spec_helper.rb
|
46
64
|
homepage: https://github.com/raykin/rails_dictionary
|
47
65
|
licenses: []
|
48
|
-
|
49
66
|
post_install_message:
|
50
67
|
rdoc_options: []
|
51
|
-
|
52
|
-
require_paths:
|
68
|
+
require_paths:
|
53
69
|
- lib
|
54
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
71
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version:
|
60
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
77
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version:
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
66
82
|
requirements: []
|
67
|
-
|
68
83
|
rubyforge_project: rails_dictionary
|
69
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.8.11
|
70
85
|
signing_key:
|
71
86
|
specification_version: 3
|
72
87
|
summary: dictionary data for web application
|
73
|
-
test_files:
|
74
|
-
- spec/fake_app.rb
|
75
|
-
- spec/rails_dictionary_spec.rb
|
76
|
-
- spec/spec_helper.rb
|
88
|
+
test_files: []
|
77
89
|
has_rdoc:
|