sequel-crushyform 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -361,6 +361,7 @@ CHANGE LOG
361
361
  0.1.1 Use strftime fordate/time (do not know why I did not !!!)
362
362
  0.1.2 Monkey patch, just prevent to have text areas instead of text fields when using PostgreSQL
363
363
  0.1.3 Still use the @schema value for :text type when :schema plugin is used
364
+ 0.1.4 Do not raise when there is a mismatch between db_schema and schema
364
365
 
365
366
  COPYRIGHT
366
367
  =========
@@ -1,7 +1,7 @@
1
1
  module ::Sequel::Plugins::Crushyform
2
2
 
3
3
  module ClassMethods
4
- def crushyform_version; [0,1,3]; end
4
+ def crushyform_version; [0,1,4]; end
5
5
  # Schema
6
6
  def crushyform_schema
7
7
  @crushyform_schema ||= default_crushyform_schema
@@ -9,7 +9,7 @@ module ::Sequel::Plugins::Crushyform
9
9
  def default_crushyform_schema
10
10
  out = {}
11
11
  db_schema.each do |k,v|
12
- out[k] = if respond_to?(:schema) && @schema.columns.find{|c|c[:name]==k}[:type]==:text
12
+ out[k] = if respond_to?(:schema) && (@schema.columns.find{|c|c[:name]==k}||{:type=>nil})[:type]==:text
13
13
  {:type=>:text} # Using :schema plugin is the safest
14
14
  elsif [:sqlite,:mysql].include?(@db.database_type) && v[:db_type]=='text'
15
15
  {:type=>:text} # Without :schema plugin Postgres uses text even for strings
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sequel-crushyform'
3
- s.version = "0.1.3"
3
+ s.version = "0.1.4"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "A Sequel plugin that helps building forms"
6
6
  s.description = "A Sequel plugin that helps building forms. It basically does them for you so that you can forget about the boring part. The kind of thing which is good to have in your toolbox for building a CMS."
@@ -131,6 +131,19 @@ end
131
131
 
132
132
  class WithAccronymYMCAName < ::Sequel::Model; end
133
133
 
134
+ DB.create_table :mismatches do
135
+ primary_key :id
136
+ String :title
137
+ text :body
138
+ end
139
+ class Mismatch < ::Sequel::Model
140
+ plugin :schema
141
+ set_schema do
142
+ primary_key :id
143
+ String :title
144
+ end
145
+ end
146
+
134
147
  # ========
135
148
  # = Test =
136
149
  # ========
@@ -173,6 +186,14 @@ describe 'Crushyform when schema plugin is used' do
173
186
  }
174
187
  end
175
188
 
189
+ should 'not raise when there is a database column that is not in @schema' do
190
+ Mismatch.default_crushyform_schema.should=={
191
+ :title=>{:type=>:string},
192
+ :id=>{:type=>:integer},
193
+ :body=>{:type=>:text}
194
+ }
195
+ end
196
+
176
197
  end
177
198
 
178
199
  describe 'Crushyform miscellaneous helpers' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-crushyform
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mickael Riga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-15 00:00:00 +01:00
18
+ date: 2011-09-29 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  requirements: []
64
64
 
65
65
  rubyforge_project:
66
- rubygems_version: 1.3.7
66
+ rubygems_version: 1.4.2
67
67
  signing_key:
68
68
  specification_version: 3
69
69
  summary: A Sequel plugin that helps building forms