super_list 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ group :development do
9
9
  gem "jeweler", "~> 1.5.2"
10
10
  gem "rcov", ">= 0"
11
11
  gem "sqlite3-ruby", :require => "sqlite3"
12
- gem "rails", "3.0.4"
12
+ gem "rails", "3.0.5"
13
13
  gem "capybara", ">= 0.4.0"
14
14
  gem "factory_girl"
15
15
  end
data/Gemfile.lock CHANGED
@@ -2,12 +2,12 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  abstract (1.0.0)
5
- actionmailer (3.0.4)
6
- actionpack (= 3.0.4)
5
+ actionmailer (3.0.5)
6
+ actionpack (= 3.0.5)
7
7
  mail (~> 2.2.15)
8
- actionpack (3.0.4)
9
- activemodel (= 3.0.4)
10
- activesupport (= 3.0.4)
8
+ actionpack (3.0.5)
9
+ activemodel (= 3.0.5)
10
+ activesupport (= 3.0.5)
11
11
  builder (~> 2.1.2)
12
12
  erubis (~> 2.6.6)
13
13
  i18n (~> 0.4)
@@ -15,20 +15,20 @@ GEM
15
15
  rack-mount (~> 0.6.13)
16
16
  rack-test (~> 0.5.7)
17
17
  tzinfo (~> 0.3.23)
18
- activemodel (3.0.4)
19
- activesupport (= 3.0.4)
18
+ activemodel (3.0.5)
19
+ activesupport (= 3.0.5)
20
20
  builder (~> 2.1.2)
21
21
  i18n (~> 0.4)
22
- activerecord (3.0.4)
23
- activemodel (= 3.0.4)
24
- activesupport (= 3.0.4)
22
+ activerecord (3.0.5)
23
+ activemodel (= 3.0.5)
24
+ activesupport (= 3.0.5)
25
25
  arel (~> 2.0.2)
26
26
  tzinfo (~> 0.3.23)
27
- activeresource (3.0.4)
28
- activemodel (= 3.0.4)
29
- activesupport (= 3.0.4)
30
- activesupport (3.0.4)
31
- arel (2.0.8)
27
+ activeresource (3.0.5)
28
+ activemodel (= 3.0.5)
29
+ activesupport (= 3.0.5)
30
+ activesupport (3.0.5)
31
+ arel (2.0.9)
32
32
  builder (2.1.2)
33
33
  capybara (0.4.1.1)
34
34
  celerity (>= 0.7.9)
@@ -68,17 +68,17 @@ GEM
68
68
  rack (>= 1.0.0)
69
69
  rack-test (0.5.7)
70
70
  rack (>= 1.0)
71
- rails (3.0.4)
72
- actionmailer (= 3.0.4)
73
- actionpack (= 3.0.4)
74
- activerecord (= 3.0.4)
75
- activeresource (= 3.0.4)
76
- activesupport (= 3.0.4)
71
+ rails (3.0.5)
72
+ actionmailer (= 3.0.5)
73
+ actionpack (= 3.0.5)
74
+ activerecord (= 3.0.5)
75
+ activeresource (= 3.0.5)
76
+ activesupport (= 3.0.5)
77
77
  bundler (~> 1.0)
78
- railties (= 3.0.4)
79
- railties (3.0.4)
80
- actionpack (= 3.0.4)
81
- activesupport (= 3.0.4)
78
+ railties (= 3.0.5)
79
+ railties (3.0.5)
80
+ actionpack (= 3.0.5)
81
+ activesupport (= 3.0.5)
82
82
  rake (>= 0.8.7)
83
83
  thor (~> 0.14.4)
84
84
  rake (0.8.7)
@@ -107,6 +107,6 @@ DEPENDENCIES
107
107
  capybara (>= 0.4.0)
108
108
  factory_girl
109
109
  jeweler (~> 1.5.2)
110
- rails (= 3.0.4)
110
+ rails (= 3.0.5)
111
111
  rcov
112
112
  sqlite3-ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
data/lib/super_list.rb CHANGED
@@ -79,7 +79,9 @@ module SuperListActiveRecord
79
79
  data = SuperList[data]
80
80
  options = data.options.merge(options)
81
81
 
82
- validates_inclusion_of original_column, { :in => data.keys }.merge(options)
82
+ unless options[:no_validation]
83
+ validates_inclusion_of original_column, { :in => data.keys }.merge(options)
84
+ end
83
85
 
84
86
  define_method "#{column}" do |*opt|
85
87
  opt = opt[0].is_a?(Hash) ? opt[0] : {}
@@ -2,4 +2,5 @@ class User < ActiveRecord::Base
2
2
  super_list :gender, 'Gender'
3
3
  super_list :gender1, 'Gender', :allow_blank => false, :use_i18n => true
4
4
  super_list :gender2, 'Gender', :use_i18n => true, :i18n_default => '未知'
5
+ super_list :gender3, 'Gender', :use_i18n => true, :i18n_default => '未知', :no_validation => true
5
6
  end
@@ -4,6 +4,7 @@ class CreateUsers < ActiveRecord::Migration
4
4
  t.string :gender
5
5
  t.string :gender1
6
6
  t.string :gender2
7
+ t.string :gender3
7
8
 
8
9
  t.timestamps
9
10
  end
data/test/factories.rb CHANGED
@@ -2,5 +2,6 @@ Factory.define :user do |t|
2
2
  t.gender 'M'
3
3
  t.gender1 'M'
4
4
  t.gender2 'M'
5
+ t.gender3 'M'
5
6
  end
6
7
 
@@ -27,6 +27,11 @@ class SuperListTest < ActiveSupport::TestCase
27
27
  assert !Factory.build(:user, :gender1 => '').valid?
28
28
  end
29
29
 
30
+ test "no validations for gender2" do
31
+ assert Factory.build(:user, :gender3 => 'A').valid?
32
+ assert Factory.build(:user, :gender3 => 'M').valid?
33
+ end
34
+
30
35
  test "SuperList gender (don't use i18n)" do
31
36
  u = Factory(:user, :gender => 'F')
32
37
  assert_equal u.gender.to_s, 'Female'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_list
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jinzhu
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-08 00:00:00 +08:00
18
+ date: 2011-03-09 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -85,12 +85,12 @@ dependencies:
85
85
  requirements:
86
86
  - - "="
87
87
  - !ruby/object:Gem::Version
88
- hash: 15
88
+ hash: 13
89
89
  segments:
90
90
  - 3
91
91
  - 0
92
- - 4
93
- version: 3.0.4
92
+ - 5
93
+ version: 3.0.5
94
94
  requirement: *id005
95
95
  prerelease: false
96
96
  name: rails