safe_attributes 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,7 +1,13 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'activesupport', '~> 3.0.0'
4
- gem 'activerecord', '~> 3.0.0'
3
+ # Kind of hacky, supposed to be cleaner with bundler 1.1 later
4
+ if ENV.has_key?('SA_WITH_3_0')
5
+ gem 'activesupport', '~> 3.0.0'
6
+ gem 'activerecord', '~> 3.0.0'
7
+ else
8
+ gem 'activesupport', '>= 3.0.0'
9
+ gem 'activerecord', '>= 3.0.0'
10
+ end
5
11
 
6
12
  group :development do
7
13
  gem 'jeweler', '>= 1.5.2'
@@ -10,7 +16,7 @@ group :development do
10
16
  gem 'rspec', '>= 2.3.0'
11
17
  gem 'rcov'
12
18
  platform :ruby do
13
- gem 'sqlite3-ruby'
19
+ gem 'sqlite3', '>= 1.3.4'
14
20
  end
15
21
  platform :jruby do
16
22
  gem 'activerecord-jdbcsqlite3-adapter'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{safe_attributes}
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Jones"]
12
- s.date = %q{2011-07-18}
12
+ s.date = %q{2011-09-25}
13
13
  s.description = %q{Better support for legacy database schemas for ActiveRecord, such as columns named class, or any other name that conflicts with an instance method of ActiveRecord.}
14
14
  s.email = %q{cbj@gnu.org}
15
15
  s.extra_rdoc_files = [
@@ -34,44 +34,44 @@ Gem::Specification.new do |s|
34
34
  s.homepage = %q{http://github.com/bjones/safe_attributes}
35
35
  s.licenses = ["MIT"]
36
36
  s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.6.2}
37
+ s.rubygems_version = %q{1.5.1}
38
38
  s.summary = %q{Useful for legacy database support, adds support for reserved word column names with ActiveRecord}
39
39
 
40
40
  if s.respond_to? :specification_version then
41
41
  s.specification_version = 3
42
42
 
43
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
- s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
45
- s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0"])
44
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
45
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
46
46
  s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
47
47
  s.add_development_dependency(%q<rake>, [">= 0.8.7"])
48
48
  s.add_development_dependency(%q<rdoc>, [">= 0"])
49
49
  s.add_development_dependency(%q<rspec>, [">= 2.3.0"])
50
50
  s.add_development_dependency(%q<rcov>, [">= 0"])
51
- s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
51
+ s.add_development_dependency(%q<sqlite3>, [">= 1.3.4"])
52
52
  s.add_development_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 0"])
53
53
  s.add_development_dependency(%q<jruby-openssl>, [">= 0"])
54
54
  else
55
- s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
56
- s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
55
+ s.add_dependency(%q<activesupport>, [">= 3.0.0"])
56
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
57
57
  s.add_dependency(%q<jeweler>, [">= 1.5.2"])
58
58
  s.add_dependency(%q<rake>, [">= 0.8.7"])
59
59
  s.add_dependency(%q<rdoc>, [">= 0"])
60
60
  s.add_dependency(%q<rspec>, [">= 2.3.0"])
61
61
  s.add_dependency(%q<rcov>, [">= 0"])
62
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
62
+ s.add_dependency(%q<sqlite3>, [">= 1.3.4"])
63
63
  s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 0"])
64
64
  s.add_dependency(%q<jruby-openssl>, [">= 0"])
65
65
  end
66
66
  else
67
- s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
68
- s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
67
+ s.add_dependency(%q<activesupport>, [">= 3.0.0"])
68
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
69
69
  s.add_dependency(%q<jeweler>, [">= 1.5.2"])
70
70
  s.add_dependency(%q<rake>, [">= 0.8.7"])
71
71
  s.add_dependency(%q<rdoc>, [">= 0"])
72
72
  s.add_dependency(%q<rspec>, [">= 2.3.0"])
73
73
  s.add_dependency(%q<rcov>, [">= 0"])
74
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
74
+ s.add_dependency(%q<sqlite3>, [">= 1.3.4"])
75
75
  s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 0"])
76
76
  s.add_dependency(%q<jruby-openssl>, [">= 0"])
77
77
  end
@@ -10,6 +10,8 @@ ActiveRecord::Base.connection.create_table(:my_models) do |t|
10
10
  t.string :changed
11
11
  # bad because normally it generates DangerousAttributeError
12
12
  t.string :errors
13
+ # support hyphenated column names
14
+ t.string :"comment-frequency"
13
15
  end
14
16
 
15
17
  class MyModel < ActiveRecord::Base
@@ -91,6 +93,12 @@ describe MyModel do
91
93
  m[:errors].should == 'my errors'
92
94
  end
93
95
 
96
+ it "can create instance in database with attribute 'comment-frequency'" do
97
+ m = MyModel.create!(:class => 'Foo', :"comment-frequency" => 'often')
98
+ m = MyModel.find(m.id)
99
+ m[:"comment-frequency"].should == 'often'
100
+ end
101
+
94
102
  it "has class attribute" do
95
103
  MyModel.new().has_attribute?('class').should be_true
96
104
  end
metadata CHANGED
@@ -1,178 +1,181 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: safe_attributes
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.5
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 1.0.6
6
6
  platform: ruby
7
- authors:
8
- - Brian Jones
7
+ authors:
8
+ - Brian Jones
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-18 00:00:00.000000000 -04:00
12
+
13
+ date: 2011-09-25 00:00:00 -04:00
13
14
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: activesupport
17
- requirement: &2155360580 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 3.0.0
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: *2155360580
26
- - !ruby/object:Gem::Dependency
27
- name: activerecord
28
- requirement: &2155360040 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 3.0.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: *2155360040
37
- - !ruby/object:Gem::Dependency
38
- name: jeweler
39
- requirement: &2155359460 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ! '>='
43
- - !ruby/object:Gem::Version
44
- version: 1.5.2
45
- type: :development
46
- prerelease: false
47
- version_requirements: *2155359460
48
- - !ruby/object:Gem::Dependency
49
- name: rake
50
- requirement: &2155358880 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: 0.8.7
56
- type: :development
57
- prerelease: false
58
- version_requirements: *2155358880
59
- - !ruby/object:Gem::Dependency
60
- name: rdoc
61
- requirement: &2155358300 !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
64
- - - ! '>='
65
- - !ruby/object:Gem::Version
66
- version: '0'
67
- type: :development
68
- prerelease: false
69
- version_requirements: *2155358300
70
- - !ruby/object:Gem::Dependency
71
- name: rspec
72
- requirement: &2155357780 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: 2.3.0
78
- type: :development
79
- prerelease: false
80
- version_requirements: *2155357780
81
- - !ruby/object:Gem::Dependency
82
- name: rcov
83
- requirement: &2155351280 !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ! '>='
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- type: :development
90
- prerelease: false
91
- version_requirements: *2155351280
92
- - !ruby/object:Gem::Dependency
93
- name: sqlite3-ruby
94
- requirement: &2155350780 !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
97
- - - ! '>='
98
- - !ruby/object:Gem::Version
99
- version: '0'
100
- type: :development
101
- prerelease: false
102
- version_requirements: *2155350780
103
- - !ruby/object:Gem::Dependency
104
- name: activerecord-jdbcsqlite3-adapter
105
- requirement: &2155350220 !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- type: :development
112
- prerelease: false
113
- version_requirements: *2155350220
114
- - !ruby/object:Gem::Dependency
115
- name: jruby-openssl
116
- requirement: &2155349680 !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ! '>='
120
- - !ruby/object:Gem::Version
121
- version: '0'
122
- type: :development
123
- prerelease: false
124
- version_requirements: *2155349680
125
- description: Better support for legacy database schemas for ActiveRecord, such as
126
- columns named class, or any other name that conflicts with an instance method of
127
- ActiveRecord.
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activesupport
18
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 3.0.0
24
+ requirement: *id001
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 3.0.0
35
+ requirement: *id002
36
+ prerelease: false
37
+ type: :runtime
38
+ - !ruby/object:Gem::Dependency
39
+ name: jeweler
40
+ version_requirements: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.2
46
+ requirement: *id003
47
+ prerelease: false
48
+ type: :development
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ version_requirements: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.8.7
57
+ requirement: *id004
58
+ prerelease: false
59
+ type: :development
60
+ - !ruby/object:Gem::Dependency
61
+ name: rdoc
62
+ version_requirements: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ requirement: *id005
69
+ prerelease: false
70
+ type: :development
71
+ - !ruby/object:Gem::Dependency
72
+ name: rspec
73
+ version_requirements: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 2.3.0
79
+ requirement: *id006
80
+ prerelease: false
81
+ type: :development
82
+ - !ruby/object:Gem::Dependency
83
+ name: rcov
84
+ version_requirements: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ requirement: *id007
91
+ prerelease: false
92
+ type: :development
93
+ - !ruby/object:Gem::Dependency
94
+ name: sqlite3
95
+ version_requirements: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 1.3.4
101
+ requirement: *id008
102
+ prerelease: false
103
+ type: :development
104
+ - !ruby/object:Gem::Dependency
105
+ name: activerecord-jdbcsqlite3-adapter
106
+ version_requirements: &id009 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ requirement: *id009
113
+ prerelease: false
114
+ type: :development
115
+ - !ruby/object:Gem::Dependency
116
+ name: jruby-openssl
117
+ version_requirements: &id010 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ requirement: *id010
124
+ prerelease: false
125
+ type: :development
126
+ description: Better support for legacy database schemas for ActiveRecord, such as columns named class, or any other name that conflicts with an instance method of ActiveRecord.
128
127
  email: cbj@gnu.org
129
128
  executables: []
129
+
130
130
  extensions: []
131
- extra_rdoc_files:
132
- - LICENSE
133
- - README.rdoc
134
- files:
135
- - .document
136
- - .rspec
137
- - Gemfile
138
- - LICENSE
139
- - NEWS.rdoc
140
- - README.rdoc
141
- - Rakefile
142
- - VERSION
143
- - lib/safe_attributes.rb
144
- - lib/safe_attributes/railtie.rb
145
- - safe_attributes.gemspec
146
- - spec/safe_attributes/safe_attributes_spec.rb
147
- - spec/spec_helper.rb
131
+
132
+ extra_rdoc_files:
133
+ - LICENSE
134
+ - README.rdoc
135
+ files:
136
+ - .document
137
+ - .rspec
138
+ - Gemfile
139
+ - LICENSE
140
+ - NEWS.rdoc
141
+ - README.rdoc
142
+ - Rakefile
143
+ - VERSION
144
+ - lib/safe_attributes.rb
145
+ - lib/safe_attributes/railtie.rb
146
+ - safe_attributes.gemspec
147
+ - spec/safe_attributes/safe_attributes_spec.rb
148
+ - spec/spec_helper.rb
148
149
  has_rdoc: true
149
150
  homepage: http://github.com/bjones/safe_attributes
150
- licenses:
151
- - MIT
151
+ licenses:
152
+ - MIT
152
153
  post_install_message:
153
154
  rdoc_options: []
154
- require_paths:
155
- - lib
156
- required_ruby_version: !ruby/object:Gem::Requirement
155
+
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
157
159
  none: false
158
- requirements:
159
- - - ! '>='
160
- - !ruby/object:Gem::Version
161
- version: '0'
162
- segments:
163
- - 0
164
- hash: -237664751269868444
165
- required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ hash: 2
164
+ segments:
165
+ - 0
166
+ version: "0"
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
168
  none: false
167
- requirements:
168
- - - ! '>='
169
- - !ruby/object:Gem::Version
170
- version: '0'
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: "0"
171
173
  requirements: []
174
+
172
175
  rubyforge_project:
173
- rubygems_version: 1.6.2
176
+ rubygems_version: 1.5.1
174
177
  signing_key:
175
178
  specification_version: 3
176
- summary: Useful for legacy database support, adds support for reserved word column
177
- names with ActiveRecord
179
+ summary: Useful for legacy database support, adds support for reserved word column names with ActiveRecord
178
180
  test_files: []
181
+