selectable_attr_rails 0.3.14 → 0.3.15

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - ruby-head
6
+ - ree
7
+ gemfile:
8
+ - gemfiles/Gemfile.rails-2.3.14
9
+ - gemfiles/Gemfile.rails-3.0.10
10
+ - gemfiles/Gemfile.rails-3.1.1
data/Gemfile CHANGED
@@ -3,18 +3,22 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- gem "activesupport", ">= 2.0.2"
7
- gem "activerecord", ">= 2.0.2"
8
- gem "actionpack", ">= 2.0.2"
9
- gem "selectable_attr", ">= 0.3.11"
6
+ gem "activesupport", ">= 2.3.14"
7
+ gem "activerecord", ">= 2.3.14"
8
+ gem "actionpack", ">= 2.3.14"
9
+ gem "selectable_attr", ">= 0.3.15"
10
10
 
11
11
  # Add dependencies to develop your gem here.
12
12
  # Include everything needed to run rake, tests, features, etc.
13
13
  group :development do
14
14
  gem "sqlite3"
15
- gem "rspec", "~> 2.3.0"
16
- gem "bundler", "~> 1.0.0"
17
- gem "jeweler", "~> 1.5.2"
18
- gem "rcov", ">= 0"
15
+ gem "rspec", "~> 2.6.0"
16
+ gem "yard", "~> 0.7.2"
17
+ gem "bundler", "~> 1.0.18"
18
+ gem "jeweler", "~> 1.6.4"
19
+ # gem "rcov", ">= 0"
20
+ gem "simplecov", "~> 0.5.3"
19
21
  gem "autotest"
22
+
23
+ gem 'rdiscount'
20
24
  end
@@ -1,6 +1,6 @@
1
- = SelectableAttrRails
1
+ # SelectableAttrRails [![Build Status](https://secure.travis-ci.org/akm/selectable_attr_rails.png)](http://travis-ci.org/akm/selectable_attr_rails)
2
2
 
3
- == Introduction
3
+ ## Introduction
4
4
  selectable_attr_railsは、selectable_attrをRailsで使うときに便利なヘルパーメソッドを提供し、
5
5
  エントリをDBから取得したり、I18n対応するものです。
6
6
  http://github.com/akm/selectable_attr_rails/tree/master
@@ -10,136 +10,136 @@ selectable_attr は、コードが割り振られるような特定の属性に
10
10
  http://github.com/akm/selectable_attr/tree/master
11
11
 
12
12
 
13
- == Install
14
- === a. plugin install
13
+ ## Install
14
+ ### a. plugin install
15
15
  ruby script/plugin install git://github.com/akm/selectable_attr.git
16
16
  ruby script/plugin install git://github.com/akm/selectable_attr_rails.git
17
17
 
18
- === b. gem install
19
- [sudo] gem install selectable_attr_rails
18
+ ### b. gem install
19
+ [sudo] gem install selectable_attr_rails
20
20
 
21
21
  config/initializers/selectable_attr.rb
22
- require 'selectable_attr'
23
- require 'selectable_attr_i18n'
24
- require 'selectable_attr_rails'
25
- SelectableAttrRails.setup
22
+ require 'selectable_attr'
23
+ require 'selectable_attr_i18n'
24
+ require 'selectable_attr_rails'
25
+ SelectableAttrRails.setup
26
26
 
27
27
 
28
- == チュートリアル
28
+ ## チュートリアル
29
29
 
30
- === selectヘルパーメソッド
30
+ ### selectヘルパーメソッド
31
31
  以下のようなモデルが定義してあった場合
32
- class Person < ActiveRecord::Base
33
- include ::SelectableAttr::Base
34
-
35
- selectable_attr :gender do
36
- entry '1', :male, '男性'
37
- entry '2', :female, '女性'
38
- entry '9', :other, 'その他'
39
- end
40
- end
32
+ class Person < ActiveRecord::Base
33
+ include ::SelectableAttr::Base
34
+
35
+ selectable_attr :gender do
36
+ entry '1', :male, '男性'
37
+ entry '2', :female, '女性'
38
+ entry '9', :other, 'その他'
39
+ end
40
+ end
41
41
 
42
42
  ビューでは以下のように選択肢を表示することができます。
43
- <% form_for(:person) do |f| %>
44
- <%= f.select :gender %>
45
- <% end %>
43
+ <% form_for(:person) do |f| %>
44
+ <%= f.select :gender %>
45
+ <% end %>
46
46
 
47
47
  form_for、fields_forを使用しない場合でも、オブジェクト名を設定して使用可能です。
48
- <%= select :person, :gender %>
48
+ <%= select :person, :gender %>
49
49
 
50
50
  また以下のように複数の値を取りうる場合にもこのメソドを使用することが可能です。
51
- class RoomSearch
52
- include ::SelectableAttr::Base
53
-
54
- multi_selectable_attr :room_type do
55
- entry '01', :single, 'シングル'
56
- entry '02', :twin, 'ツイン'
57
- entry '03', :double, 'ダブル'
58
- entry '04', :triple, 'トリプル'
59
- end
60
- end
61
-
62
- <% form_for(:room_search) do |f| %>
63
- <%= f.select :room_type %>
64
- <% end %>
51
+ class RoomSearch
52
+ include ::SelectableAttr::Base
53
+
54
+ multi_selectable_attr :room_type do
55
+ entry '01', :single, 'シングル'
56
+ entry '02', :twin, 'ツイン'
57
+ entry '03', :double, 'ダブル'
58
+ entry '04', :triple, 'トリプル'
59
+ end
60
+ end
61
+
62
+ <% form_for(:room_search) do |f| %>
63
+ <%= f.select :room_type %>
64
+ <% end %>
65
65
 
66
66
  この場合、出力されるselectタグのmultiple属性が設定されます。
67
67
 
68
68
 
69
69
 
70
- === radio_button_groupヘルパーメソッド
70
+ ### radio_button_groupヘルパーメソッド
71
71
  一つだけ値を選択するUIの場合、selectメソッドではなく<input type="radio".../>を出力することも可能です。
72
72
  上記Personモデルの場合
73
73
 
74
- <% form_for(:person) do |f| %>
75
- <%= f.radio_button_group :gender %>
76
- <% end %>
74
+ <% form_for(:person) do |f| %>
75
+ <%= f.radio_button_group :gender %>
76
+ <% end %>
77
77
 
78
78
  この場合、<input type="radio" .../><label for="xxx">... という風に続けて出力されるので、改行などを出力したい場合は
79
79
  引数を一つ取るブロックを渡して以下のように記述します。
80
80
 
81
- <% form_for(:person) do |f| %>
82
- <% f.radio_button_group :gender do |b| %>
83
- <% b.each do %>
84
- <%= b.radio_button %>
85
- <%= b.label %>
86
- <br/>
87
- <% end %>
88
- <% end %>
89
- <% end %>
81
+ <% form_for(:person) do |f| %>
82
+ <% f.radio_button_group :gender do |b| %>
83
+ <% b.each do %>
84
+ <%= b.radio_button %>
85
+ <%= b.label %>
86
+ <br/>
87
+ <% end %>
88
+ <% end %>
89
+ <% end %>
90
90
 
91
- f.radio_button_groupを呼び出しているERBのタグが、<%= %>から<% %>に変わっていることにご注意ください。
91
+ f.radio_button_groupを呼び出しているERBのタグが、<%= %>から<% %>に変わっていることにご注意ください。
92
92
 
93
93
 
94
- === check_box_groupヘルパーメソッド
94
+ ### check_box_groupヘルパーメソッド
95
95
  複数の値を選択するUIの場合、selectメソッドではなく<input type="checkbox".../>を出力することも可能です。
96
96
  上記RoomSearchクラスの場合
97
97
 
98
- <% form_for(:room_search) do |f| %>
99
- <%= f.check_box_group :room_type %>
100
- <% end %>
98
+ <% form_for(:room_search) do |f| %>
99
+ <%= f.check_box_group :room_type %>
100
+ <% end %>
101
101
 
102
102
  この場合、<input type="checkbox" .../><label for="xxx">... という風に続けて出力されるので、改行などを出力したい場合は
103
103
  引数を一つ取るブロックを渡して以下のように記述します。
104
104
 
105
- <% form_for(:person) do |f| %>
106
- <% f.check_box_group :gender do |b| %>
107
- <% b.each do %>
108
- <%= b.check_box %>
109
- <%= b.label %>
110
- <br/>
111
- <% end %>
112
- <% end %>
113
- <% end %>
105
+ <% form_for(:person) do |f| %>
106
+ <% f.check_box_group :gender do |b| %>
107
+ <% b.each do %>
108
+ <%= b.check_box %>
109
+ <%= b.label %>
110
+ <br/>
111
+ <% end %>
112
+ <% end %>
113
+ <% end %>
114
114
 
115
115
  f.check_box_groupを呼び出しているERBのタグが、<%= %>から<% %>に変わっていることにご注意ください。
116
116
 
117
117
 
118
- == DBからのエントリの更新/追加
118
+ ## DBからのエントリの更新/追加
119
119
  各エントリの名称を実行時に変更したり、項目を追加することが可能です。
120
120
 
121
- class RoomPlan < ActiveRecord::Base
122
- include ::SelectableAttr::Base
123
-
124
- selectable_attr :room_type do
125
- update_by "select room_type, name from room_types"
126
- entry '01', :single, 'シングル'
127
- entry '02', :twin, 'ツイン'
128
- entry '03', :double, 'ダブル'
129
- entry '04', :triple, 'トリプル'
130
- end
131
- end
121
+ class RoomPlan < ActiveRecord::Base
122
+ include ::SelectableAttr::Base
123
+
124
+ selectable_attr :room_type do
125
+ update_by "select room_type, name from room_types"
126
+ entry '01', :single, 'シングル'
127
+ entry '02', :twin, 'ツイン'
128
+ entry '03', :double, 'ダブル'
129
+ entry '04', :triple, 'トリプル'
130
+ end
131
+ end
132
132
 
133
133
  というモデルと
134
134
 
135
- create_table "room_types" do |t|
136
- t.string "room_type", :limit => 2
137
- t.string "name", :limit => 20
138
- end
135
+ create_table "room_types" do |t|
136
+ t.string "room_type", :limit => 2
137
+ t.string "name", :limit => 20
138
+ end
139
139
 
140
140
  というマイグレーションで作成されるテーブルがあったとします。
141
141
 
142
- === エントリの追加
142
+ ### エントリの追加
143
143
  room_typeが"05"、nameが"4ベッド"というレコードがINSERTされた後、
144
144
  RoomPlan#room_type_optionsなどのselectable_attrが提供するメソッドで
145
145
  各エントリへアクセスすると、update_byで指定されたSELECT文が実行され、
@@ -149,7 +149,7 @@ RoomPlan#room_type_optionsなどのselectable_attrが提供するメソッドで
149
149
 
150
150
  このようにコードで定義されていないエントリは、DELETEされると、エントリもなくなります。
151
151
 
152
- === エントリの名称の更新
152
+ ### エントリの名称の更新
153
153
  実行時に名称を変えたい場合には、そのidに該当するレコードを追加/更新します。
154
154
  例えば、
155
155
  room_typeが"04"、nameが"3ベッド"というレコードがINSERTされると、その後は
@@ -160,45 +160,45 @@ room_typeが"04"、nameが"3ベッド"というレコードがINSERTされる
160
160
  DELETE後は、名称が元に戻ります。
161
161
 
162
162
 
163
- == I18n対応
163
+ ## I18n対応
164
164
  エントリのロケールにおける名称をRails2.2からの機能である、I18nを内部的にしようして取得できます。
165
165
 
166
166
  上記RoomPlanモデルの場合、
167
167
 
168
168
  config/locales/ja.yml
169
- ja:
170
- selectable_attrs:
171
- room_types:
172
- single: シングル
173
- twin: ツイン
174
- double: ダブル
175
- triple: トリプル
169
+ ja:
170
+ selectable_attrs:
171
+ room_types:
172
+ single: シングル
173
+ twin: ツイン
174
+ double: ダブル
175
+ triple: トリプル
176
176
 
177
177
  config/locales/en.yml
178
- en:
179
- selectable_attrs:
180
- room_types:
181
- single: Single
182
- twin: Twin
183
- double: Double
184
- triple: Triple
178
+ en:
179
+ selectable_attrs:
180
+ room_types:
181
+ single: Single
182
+ twin: Twin
183
+ double: Double
184
+ triple: Triple
185
185
 
186
186
  というYAMLを用意した上で、モデルを以下のように記述します。
187
187
 
188
- class RoomPlan < ActiveRecord::Base
189
- include ::SelectableAttr::Base
190
-
191
- selectable_attr :room_type do
192
- i18n_scope(:selectable_attrs, :room_types)
193
- entry '01', :single, 'シングル'
194
- entry '02', :twin, 'ツイン'
195
- entry '03', :double, 'ダブル'
196
- entry '04', :triple, 'トリプル'
197
- end
198
- end
188
+ class RoomPlan < ActiveRecord::Base
189
+ include ::SelectableAttr::Base
190
+
191
+ selectable_attr :room_type do
192
+ i18n_scope(:selectable_attrs, :room_types)
193
+ entry '01', :single, 'シングル'
194
+ entry '02', :twin, 'ツイン'
195
+ entry '03', :double, 'ダブル'
196
+ entry '04', :triple, 'トリプル'
197
+ end
198
+ end
199
199
 
200
200
  これで、I18n.localeに設定されているロケールに従って各エントリの名称が変わります。
201
201
 
202
202
 
203
- == Credit
203
+ ## Credit
204
204
  Copyright (c) 2008 Takeshi AKIMA, released under the MIT lice nse
data/Rakefile CHANGED
@@ -23,19 +23,6 @@ Jeweler::Tasks.new do |gem|
23
23
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
24
  # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
25
  # gem.add_development_dependency 'rspec', '> 1.2.3'
26
-
27
- gem.add_runtime_dependency "activesupport", ">= 2.0.2"
28
- gem.add_runtime_dependency "activerecord", ">= 2.0.2"
29
- gem.add_runtime_dependency "actionpack", ">= 2.0.2"
30
- gem.add_runtime_dependency "selectable_attr", ">= 0.3.11"
31
-
32
- gem.add_development_dependency "sqlite3"
33
- gem.add_development_dependency "rspec", "~> 2.3.0"
34
- gem.add_development_dependency "bundler", "~> 1.0.0"
35
- gem.add_development_dependency "jeweler", "~> 1.5.2"
36
- gem.add_development_dependency "rcov", ">= 0"
37
- gem.add_development_dependency "autotest"
38
-
39
26
  end
40
27
  Jeweler::RubygemsDotOrgTasks.new
41
28
 
@@ -51,13 +38,7 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
51
38
  end
52
39
 
53
40
  task :default => :spec
41
+ task :test => :spec # for rubygems-test
54
42
 
55
- require 'rake/rdoctask'
56
- Rake::RDocTask.new do |rdoc|
57
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
58
-
59
- rdoc.rdoc_dir = 'rdoc'
60
- rdoc.title = "selectable_attr_rails #{version}"
61
- rdoc.rdoc_files.include('README*')
62
- rdoc.rdoc_files.include('lib/**/*.rb')
63
- end
43
+ require 'yard'
44
+ YARD::Rake::YardocTask.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.14
1
+ 0.3.15
@@ -0,0 +1,24 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "activesupport", "= 2.3.14"
7
+ gem "activerecord", "= 2.3.14"
8
+ gem "actionpack", "= 2.3.14"
9
+ gem "selectable_attr", ">= 0.3.11"
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ gem "sqlite3"
15
+ gem "rspec", "~> 2.6.0"
16
+ gem "yard", "~> 0.7.2"
17
+ gem "bundler", "~> 1.0.18"
18
+ gem "jeweler", "~> 1.6.4"
19
+ # gem "rcov", ">= 0"
20
+ gem "simplecov", "~> 0.5.3"
21
+ gem "autotest"
22
+
23
+ gem 'rdiscount'
24
+ end
@@ -0,0 +1,24 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "activesupport", "= 3.0.10"
7
+ gem "activerecord", "= 3.0.10"
8
+ gem "actionpack", "= 3.0.10"
9
+ gem "selectable_attr", ">= 0.3.11"
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ gem "sqlite3"
15
+ gem "rspec", "~> 2.6.0"
16
+ gem "yard", "~> 0.7.2"
17
+ gem "bundler", "~> 1.0.18"
18
+ gem "jeweler", "~> 1.6.4"
19
+ # gem "rcov", ">= 0"
20
+ gem "simplecov", "~> 0.5.3"
21
+ gem "autotest"
22
+
23
+ gem 'rdiscount'
24
+ end
@@ -0,0 +1,24 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "activesupport", "= 3.1.1"
7
+ gem "activerecord", "= 3.1.1"
8
+ gem "actionpack", "= 3.1.1"
9
+ gem "selectable_attr", ">= 0.3.11"
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ gem "sqlite3"
15
+ gem "rspec", "~> 2.6.0"
16
+ gem "yard", "~> 0.7.2"
17
+ gem "bundler", "~> 1.0.18"
18
+ gem "jeweler", "~> 1.6.4"
19
+ # gem "rcov", ">= 0"
20
+ gem "simplecov", "~> 0.5.3"
21
+ gem "autotest"
22
+
23
+ gem 'rdiscount'
24
+ end
@@ -22,20 +22,6 @@ if defined?(I18n)
22
22
  end
23
23
  result
24
24
  end
25
-
26
- def i18n_scope(*path)
27
- @i18n_scope = path unless path.empty?
28
- @i18n_scope
29
- end
30
-
31
- class Entry
32
- def name
33
- I18n.locale.nil? ? @name :
34
- @enum.i18n_scope.blank? ? @name :
35
- I18n.translate(key, :scope => @enum.i18n_scope, :default => @name)
36
- end
37
- end
38
-
39
25
  end
40
26
  end
41
27
  end
@@ -4,23 +4,27 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{selectable_attr_rails}
8
- s.version = "0.3.14"
7
+ s.name = "selectable_attr_rails"
8
+ s.version = "0.3.15"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Takeshi Akima"]
12
- s.date = %q{2011-02-07}
13
- s.description = %q{selectable_attr_rails makes possible to use selectable_attr in rails application}
14
- s.email = %q{akm2000@gmail.com}
12
+ s.date = "2011-11-03"
13
+ s.description = "selectable_attr_rails makes possible to use selectable_attr in rails application"
14
+ s.email = "akm2000@gmail.com"
15
15
  s.extra_rdoc_files = [
16
- "README"
16
+ "README.md"
17
17
  ]
18
18
  s.files = [
19
+ ".travis.yml",
19
20
  "Gemfile",
20
21
  "MIT-LICENSE",
21
- "README",
22
+ "README.md",
22
23
  "Rakefile",
23
24
  "VERSION",
25
+ "gemfiles/Gemfile.rails-2.3.14",
26
+ "gemfiles/Gemfile.rails-3.0.10",
27
+ "gemfiles/Gemfile.rails-3.1.1",
24
28
  "init.rb",
25
29
  "install.rb",
26
30
  "lib/selectable_attr_i18n.rb",
@@ -44,86 +48,55 @@ Gem::Specification.new do |s|
44
48
  "spec/spec_helper.rb",
45
49
  "uninstall.rb"
46
50
  ]
47
- s.homepage = %q{http://github.com/akm/selectable_attr_rails/}
51
+ s.homepage = "http://github.com/akm/selectable_attr_rails/"
48
52
  s.licenses = ["MIT"]
49
53
  s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.3.7}
51
- s.summary = %q{selectable_attr_rails makes possible to use selectable_attr in rails application}
52
- s.test_files = [
53
- "spec/introduction_spec.rb",
54
- "spec/schema.rb",
55
- "spec/selectable_attr_i18n_spec.rb",
56
- "spec/spec_helper.rb"
57
- ]
54
+ s.rubygems_version = "1.8.10"
55
+ s.summary = "selectable_attr_rails makes possible to use selectable_attr in rails application"
58
56
 
59
57
  if s.respond_to? :specification_version then
60
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
61
58
  s.specification_version = 3
62
59
 
63
60
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
- s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
65
- s.add_runtime_dependency(%q<activerecord>, [">= 2.0.2"])
66
- s.add_runtime_dependency(%q<actionpack>, [">= 2.0.2"])
67
- s.add_runtime_dependency(%q<selectable_attr>, [">= 0.3.11"])
68
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
69
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
70
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
71
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
72
- s.add_development_dependency(%q<rcov>, [">= 0"])
73
- s.add_development_dependency(%q<autotest>, [">= 0"])
74
- s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
75
- s.add_runtime_dependency(%q<activerecord>, [">= 2.0.2"])
76
- s.add_runtime_dependency(%q<actionpack>, [">= 2.0.2"])
77
- s.add_runtime_dependency(%q<selectable_attr>, [">= 0.3.11"])
61
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.14"])
62
+ s.add_runtime_dependency(%q<activerecord>, [">= 2.3.14"])
63
+ s.add_runtime_dependency(%q<actionpack>, [">= 2.3.14"])
64
+ s.add_runtime_dependency(%q<selectable_attr>, [">= 0.3.15"])
78
65
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
79
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
80
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
81
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
82
- s.add_development_dependency(%q<rcov>, [">= 0"])
66
+ s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
67
+ s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
68
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.18"])
69
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
70
+ s.add_development_dependency(%q<simplecov>, ["~> 0.5.3"])
83
71
  s.add_development_dependency(%q<autotest>, [">= 0"])
72
+ s.add_development_dependency(%q<rdiscount>, [">= 0"])
84
73
  else
85
- s.add_dependency(%q<activesupport>, [">= 2.0.2"])
86
- s.add_dependency(%q<activerecord>, [">= 2.0.2"])
87
- s.add_dependency(%q<actionpack>, [">= 2.0.2"])
88
- s.add_dependency(%q<selectable_attr>, [">= 0.3.11"])
89
- s.add_dependency(%q<sqlite3>, [">= 0"])
90
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
91
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
92
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
93
- s.add_dependency(%q<rcov>, [">= 0"])
94
- s.add_dependency(%q<autotest>, [">= 0"])
95
- s.add_dependency(%q<activesupport>, [">= 2.0.2"])
96
- s.add_dependency(%q<activerecord>, [">= 2.0.2"])
97
- s.add_dependency(%q<actionpack>, [">= 2.0.2"])
98
- s.add_dependency(%q<selectable_attr>, [">= 0.3.11"])
74
+ s.add_dependency(%q<activesupport>, [">= 2.3.14"])
75
+ s.add_dependency(%q<activerecord>, [">= 2.3.14"])
76
+ s.add_dependency(%q<actionpack>, [">= 2.3.14"])
77
+ s.add_dependency(%q<selectable_attr>, [">= 0.3.15"])
99
78
  s.add_dependency(%q<sqlite3>, [">= 0"])
100
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
101
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
102
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
103
- s.add_dependency(%q<rcov>, [">= 0"])
79
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
80
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
81
+ s.add_dependency(%q<bundler>, ["~> 1.0.18"])
82
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
83
+ s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
104
84
  s.add_dependency(%q<autotest>, [">= 0"])
85
+ s.add_dependency(%q<rdiscount>, [">= 0"])
105
86
  end
106
87
  else
107
- s.add_dependency(%q<activesupport>, [">= 2.0.2"])
108
- s.add_dependency(%q<activerecord>, [">= 2.0.2"])
109
- s.add_dependency(%q<actionpack>, [">= 2.0.2"])
110
- s.add_dependency(%q<selectable_attr>, [">= 0.3.11"])
111
- s.add_dependency(%q<sqlite3>, [">= 0"])
112
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
113
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
114
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
115
- s.add_dependency(%q<rcov>, [">= 0"])
116
- s.add_dependency(%q<autotest>, [">= 0"])
117
- s.add_dependency(%q<activesupport>, [">= 2.0.2"])
118
- s.add_dependency(%q<activerecord>, [">= 2.0.2"])
119
- s.add_dependency(%q<actionpack>, [">= 2.0.2"])
120
- s.add_dependency(%q<selectable_attr>, [">= 0.3.11"])
88
+ s.add_dependency(%q<activesupport>, [">= 2.3.14"])
89
+ s.add_dependency(%q<activerecord>, [">= 2.3.14"])
90
+ s.add_dependency(%q<actionpack>, [">= 2.3.14"])
91
+ s.add_dependency(%q<selectable_attr>, [">= 0.3.15"])
121
92
  s.add_dependency(%q<sqlite3>, [">= 0"])
122
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
123
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
124
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
125
- s.add_dependency(%q<rcov>, [">= 0"])
93
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
94
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
95
+ s.add_dependency(%q<bundler>, ["~> 1.0.18"])
96
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
97
+ s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
126
98
  s.add_dependency(%q<autotest>, [">= 0"])
99
+ s.add_dependency(%q<rdiscount>, [">= 0"])
127
100
  end
128
101
  end
129
102
 
@@ -191,7 +191,11 @@ describe SelectableAttr do
191
191
  p1.product_type_cd = 'XX'
192
192
  p1.product_type_cd.should == 'XX'
193
193
  p1.valid?.should == false
194
- p1.errors.on(:product_type_cd).should == "は次のいずれかでなければなりません。 書籍, DVD, CD, その他"
194
+ if ActiveRecord::VERSION::MAJOR <= 2
195
+ p1.errors.on(:product_type_cd).should == "は次のいずれかでなければなりません。 書籍, DVD, CD, その他"
196
+ else
197
+ p1.errors[:product_type_cd].should == ["は次のいずれかでなければなりません。 書籍, DVD, CD, その他"]
198
+ end
195
199
  end
196
200
 
197
201
  # selectable_attrのエントリ名をDB上に保持するためのモデル
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ require 'active_support'
7
7
  require 'active_record'
8
8
  require 'active_record/fixtures'
9
9
  require 'active_record/test_case'
10
+ require 'action_controller'
10
11
  require 'action_view'
11
12
 
12
13
  require 'selectable_attr'
metadata CHANGED
@@ -1,324 +1,165 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: selectable_attr_rails
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 14
9
- version: 0.3.14
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.15
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Takeshi Akima
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-02-07 00:00:00 +09:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: activesupport
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70146083172300 !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 0
30
- - 2
31
- version: 2.0.2
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.3.14
32
22
  type: :runtime
33
23
  prerelease: false
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *70146083172300
25
+ - !ruby/object:Gem::Dependency
36
26
  name: activerecord
37
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &70146083171760 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 2
44
- - 0
45
- - 2
46
- version: 2.0.2
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.3.14
47
33
  type: :runtime
48
34
  prerelease: false
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *70146083171760
36
+ - !ruby/object:Gem::Dependency
51
37
  name: actionpack
52
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &70146083171220 !ruby/object:Gem::Requirement
53
39
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- segments:
58
- - 2
59
- - 0
60
- - 2
61
- version: 2.0.2
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 2.3.14
62
44
  type: :runtime
63
45
  prerelease: false
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *70146083171220
47
+ - !ruby/object:Gem::Dependency
66
48
  name: selectable_attr
67
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &70146083170720 !ruby/object:Gem::Requirement
68
50
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- segments:
73
- - 0
74
- - 3
75
- - 11
76
- version: 0.3.11
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.15
77
55
  type: :runtime
78
56
  prerelease: false
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *70146083170720
58
+ - !ruby/object:Gem::Dependency
81
59
  name: sqlite3
82
- requirement: &id005 !ruby/object:Gem::Requirement
60
+ requirement: &70146083170200 !ruby/object:Gem::Requirement
83
61
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
90
66
  type: :development
91
67
  prerelease: false
92
- version_requirements: *id005
93
- - !ruby/object:Gem::Dependency
68
+ version_requirements: *70146083170200
69
+ - !ruby/object:Gem::Dependency
94
70
  name: rspec
95
- requirement: &id006 !ruby/object:Gem::Requirement
96
- none: false
97
- requirements:
98
- - - ~>
99
- - !ruby/object:Gem::Version
100
- segments:
101
- - 2
102
- - 3
103
- - 0
104
- version: 2.3.0
105
- type: :development
106
- prerelease: false
107
- version_requirements: *id006
108
- - !ruby/object:Gem::Dependency
109
- name: bundler
110
- requirement: &id007 !ruby/object:Gem::Requirement
71
+ requirement: &70146083169580 !ruby/object:Gem::Requirement
111
72
  none: false
112
- requirements:
73
+ requirements:
113
74
  - - ~>
114
- - !ruby/object:Gem::Version
115
- segments:
116
- - 1
117
- - 0
118
- - 0
119
- version: 1.0.0
75
+ - !ruby/object:Gem::Version
76
+ version: 2.6.0
120
77
  type: :development
121
78
  prerelease: false
122
- version_requirements: *id007
123
- - !ruby/object:Gem::Dependency
124
- name: jeweler
125
- requirement: &id008 !ruby/object:Gem::Requirement
79
+ version_requirements: *70146083169580
80
+ - !ruby/object:Gem::Dependency
81
+ name: yard
82
+ requirement: &70146083168960 !ruby/object:Gem::Requirement
126
83
  none: false
127
- requirements:
84
+ requirements:
128
85
  - - ~>
129
- - !ruby/object:Gem::Version
130
- segments:
131
- - 1
132
- - 5
133
- - 2
134
- version: 1.5.2
135
- type: :development
136
- prerelease: false
137
- version_requirements: *id008
138
- - !ruby/object:Gem::Dependency
139
- name: rcov
140
- requirement: &id009 !ruby/object:Gem::Requirement
141
- none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- segments:
146
- - 0
147
- version: "0"
148
- type: :development
149
- prerelease: false
150
- version_requirements: *id009
151
- - !ruby/object:Gem::Dependency
152
- name: autotest
153
- requirement: &id010 !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- segments:
159
- - 0
160
- version: "0"
161
- type: :development
162
- prerelease: false
163
- version_requirements: *id010
164
- - !ruby/object:Gem::Dependency
165
- name: activesupport
166
- requirement: &id011 !ruby/object:Gem::Requirement
167
- none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- segments:
172
- - 2
173
- - 0
174
- - 2
175
- version: 2.0.2
176
- type: :runtime
177
- prerelease: false
178
- version_requirements: *id011
179
- - !ruby/object:Gem::Dependency
180
- name: activerecord
181
- requirement: &id012 !ruby/object:Gem::Requirement
182
- none: false
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- segments:
187
- - 2
188
- - 0
189
- - 2
190
- version: 2.0.2
191
- type: :runtime
192
- prerelease: false
193
- version_requirements: *id012
194
- - !ruby/object:Gem::Dependency
195
- name: actionpack
196
- requirement: &id013 !ruby/object:Gem::Requirement
197
- none: false
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- segments:
202
- - 2
203
- - 0
204
- - 2
205
- version: 2.0.2
206
- type: :runtime
207
- prerelease: false
208
- version_requirements: *id013
209
- - !ruby/object:Gem::Dependency
210
- name: selectable_attr
211
- requirement: &id014 !ruby/object:Gem::Requirement
212
- none: false
213
- requirements:
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- segments:
217
- - 0
218
- - 3
219
- - 11
220
- version: 0.3.11
221
- type: :runtime
222
- prerelease: false
223
- version_requirements: *id014
224
- - !ruby/object:Gem::Dependency
225
- name: sqlite3
226
- requirement: &id015 !ruby/object:Gem::Requirement
227
- none: false
228
- requirements:
229
- - - ">="
230
- - !ruby/object:Gem::Version
231
- segments:
232
- - 0
233
- version: "0"
86
+ - !ruby/object:Gem::Version
87
+ version: 0.7.2
234
88
  type: :development
235
89
  prerelease: false
236
- version_requirements: *id015
237
- - !ruby/object:Gem::Dependency
238
- name: rspec
239
- requirement: &id016 !ruby/object:Gem::Requirement
90
+ version_requirements: *70146083168960
91
+ - !ruby/object:Gem::Dependency
92
+ name: bundler
93
+ requirement: &70146083168320 !ruby/object:Gem::Requirement
240
94
  none: false
241
- requirements:
95
+ requirements:
242
96
  - - ~>
243
- - !ruby/object:Gem::Version
244
- segments:
245
- - 2
246
- - 3
247
- - 0
248
- version: 2.3.0
97
+ - !ruby/object:Gem::Version
98
+ version: 1.0.18
249
99
  type: :development
250
100
  prerelease: false
251
- version_requirements: *id016
252
- - !ruby/object:Gem::Dependency
253
- name: bundler
254
- requirement: &id017 !ruby/object:Gem::Requirement
101
+ version_requirements: *70146083168320
102
+ - !ruby/object:Gem::Dependency
103
+ name: jeweler
104
+ requirement: &70146083167700 !ruby/object:Gem::Requirement
255
105
  none: false
256
- requirements:
106
+ requirements:
257
107
  - - ~>
258
- - !ruby/object:Gem::Version
259
- segments:
260
- - 1
261
- - 0
262
- - 0
263
- version: 1.0.0
108
+ - !ruby/object:Gem::Version
109
+ version: 1.6.4
264
110
  type: :development
265
111
  prerelease: false
266
- version_requirements: *id017
267
- - !ruby/object:Gem::Dependency
268
- name: jeweler
269
- requirement: &id018 !ruby/object:Gem::Requirement
112
+ version_requirements: *70146083167700
113
+ - !ruby/object:Gem::Dependency
114
+ name: simplecov
115
+ requirement: &70146083166980 !ruby/object:Gem::Requirement
270
116
  none: false
271
- requirements:
117
+ requirements:
272
118
  - - ~>
273
- - !ruby/object:Gem::Version
274
- segments:
275
- - 1
276
- - 5
277
- - 2
278
- version: 1.5.2
119
+ - !ruby/object:Gem::Version
120
+ version: 0.5.3
279
121
  type: :development
280
122
  prerelease: false
281
- version_requirements: *id018
282
- - !ruby/object:Gem::Dependency
283
- name: rcov
284
- requirement: &id019 !ruby/object:Gem::Requirement
123
+ version_requirements: *70146083166980
124
+ - !ruby/object:Gem::Dependency
125
+ name: autotest
126
+ requirement: &70146083166280 !ruby/object:Gem::Requirement
285
127
  none: false
286
- requirements:
287
- - - ">="
288
- - !ruby/object:Gem::Version
289
- segments:
290
- - 0
291
- version: "0"
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
292
132
  type: :development
293
133
  prerelease: false
294
- version_requirements: *id019
295
- - !ruby/object:Gem::Dependency
296
- name: autotest
297
- requirement: &id020 !ruby/object:Gem::Requirement
134
+ version_requirements: *70146083166280
135
+ - !ruby/object:Gem::Dependency
136
+ name: rdiscount
137
+ requirement: &70146083134500 !ruby/object:Gem::Requirement
298
138
  none: false
299
- requirements:
300
- - - ">="
301
- - !ruby/object:Gem::Version
302
- segments:
303
- - 0
304
- version: "0"
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
305
143
  type: :development
306
144
  prerelease: false
307
- version_requirements: *id020
308
- description: selectable_attr_rails makes possible to use selectable_attr in rails application
145
+ version_requirements: *70146083134500
146
+ description: selectable_attr_rails makes possible to use selectable_attr in rails
147
+ application
309
148
  email: akm2000@gmail.com
310
149
  executables: []
311
-
312
150
  extensions: []
313
-
314
- extra_rdoc_files:
315
- - README
316
- files:
151
+ extra_rdoc_files:
152
+ - README.md
153
+ files:
154
+ - .travis.yml
317
155
  - Gemfile
318
156
  - MIT-LICENSE
319
- - README
157
+ - README.md
320
158
  - Rakefile
321
159
  - VERSION
160
+ - gemfiles/Gemfile.rails-2.3.14
161
+ - gemfiles/Gemfile.rails-3.0.10
162
+ - gemfiles/Gemfile.rails-3.1.1
322
163
  - init.rb
323
164
  - install.rb
324
165
  - lib/selectable_attr_i18n.rb
@@ -341,41 +182,32 @@ files:
341
182
  - spec/selectable_attr_i18n_spec.rb
342
183
  - spec/spec_helper.rb
343
184
  - uninstall.rb
344
- has_rdoc: true
345
185
  homepage: http://github.com/akm/selectable_attr_rails/
346
- licenses:
186
+ licenses:
347
187
  - MIT
348
188
  post_install_message:
349
189
  rdoc_options: []
350
-
351
- require_paths:
190
+ require_paths:
352
191
  - lib
353
- required_ruby_version: !ruby/object:Gem::Requirement
192
+ required_ruby_version: !ruby/object:Gem::Requirement
354
193
  none: false
355
- requirements:
356
- - - ">="
357
- - !ruby/object:Gem::Version
358
- hash: 3629518717196867583
359
- segments:
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ segments:
360
199
  - 0
361
- version: "0"
362
- required_rubygems_version: !ruby/object:Gem::Requirement
200
+ hash: -3713791415414522865
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
363
202
  none: false
364
- requirements:
365
- - - ">="
366
- - !ruby/object:Gem::Version
367
- segments:
368
- - 0
369
- version: "0"
203
+ requirements:
204
+ - - ! '>='
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
370
207
  requirements: []
371
-
372
208
  rubyforge_project:
373
- rubygems_version: 1.3.7
209
+ rubygems_version: 1.8.10
374
210
  signing_key:
375
211
  specification_version: 3
376
212
  summary: selectable_attr_rails makes possible to use selectable_attr in rails application
377
- test_files:
378
- - spec/introduction_spec.rb
379
- - spec/schema.rb
380
- - spec/selectable_attr_i18n_spec.rb
381
- - spec/spec_helper.rb
213
+ test_files: []