scaffolding_extensions 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -21,14 +21,14 @@ to better suit your needs.
21
21
  Scaffolding Extensions currently supports:
22
22
 
23
23
  * Web Frameworks
24
- * Rails 2.0
25
- * Ramaze 0.3.9.5
24
+ * Rails 2.1
25
+ * Ramaze 2008.06
26
26
  * Camping 1.5
27
27
  * Sinatra 0.2.2
28
28
  * Object/Relational Mappers
29
- * ActiveRecord 2.0
29
+ * ActiveRecord 2.1
30
30
  * DataMapper 0.3.1
31
- * Sequel 1.5.0
31
+ * Sequel 2.0.1
32
32
  * Javascript Libaries (used for Ajax/Autocompleting)
33
33
  * Prototype 1.6.0.1
34
34
  * JQuery 1.2.3
@@ -573,7 +573,7 @@ module ScaffoldingExtensions::MetaModel
573
573
  # Set the object's attributes with the given attributes
574
574
  def scaffold_set_attributes(object, attributes)
575
575
  attributes.each do |k,v|
576
- v = nil if v.empty? && scaffold_table_column_type(k) == :boolean
576
+ v = nil if v.empty? and scaffold_table_column_type(k) == :boolean
577
577
  object.send("#{k}=", v)
578
578
  end
579
579
  end
@@ -29,7 +29,7 @@ module ScaffoldingExtensions::MetaSequel
29
29
 
30
30
  # The class that this model is associated with via the association
31
31
  def scaffold_associated_class(association)
32
- associated_class(association_reflection(association))
32
+ association_reflection(association).associated_class
33
33
  end
34
34
 
35
35
  # All objects that are currently associated with the given object. This method does not
@@ -137,7 +137,7 @@ module ScaffoldingExtensions::MetaSequel
137
137
  # Return the class, left foreign key, right foreign key, and join table for this habtm association
138
138
  def scaffold_habtm_reflection_options(association)
139
139
  reflection = scaffold_association(association)
140
- [reflection[:class], reflection[:left_key], reflection[:right_key], reflection[:join_table]]
140
+ [reflection.associated_class, reflection[:left_key], reflection[:right_key], reflection[:join_table]]
141
141
  end
142
142
 
143
143
  # Returns a hash of values to be used as url parameters on the link to create a new
@@ -157,15 +157,22 @@ module ScaffoldingExtensions::MetaSequel
157
157
  object.save
158
158
  end
159
159
 
160
- # Sequel doesn't keep enough reflection information, so assume string unless
161
- # specified by @scaffold_column_types.
160
+ # Get the column type from the schema. Sequel doesn't differentiate between string and
161
+ # text columns (since both are the same in ruby), so check if the database type is
162
+ # text or if more than 255 characters allowed in the field and return :text if the type
163
+ # is string.
162
164
  def scaffold_table_column_type(column)
163
- # column is provided by the user, so we can't just .to_sym it
164
- @scaffold_column_types_strings ||= Hash.new do |h,k1|
165
- @scaffold_column_types.each{|k2,v| h[k2] = v; h[k2.to_s] = v}
166
- h[k1] if h.include?(k1)
165
+ if String === column
166
+ return nil unless str_columns.include?(column)
167
+ column = column.to_sym
168
+ end
169
+ if column_info = db_schema[column] and type = column_info[:type]
170
+ if type == :string && (column_info[:db_type] == "text" || ((mc = column_info[:max_chars]) && mc > 255))
171
+ :text
172
+ else
173
+ type
174
+ end
167
175
  end
168
- @scaffold_column_types_strings[column] || :string
169
176
  end
170
177
 
171
178
  # The name of the underlying table
@@ -186,11 +193,14 @@ module ScaffoldingExtensions::MetaSequel
186
193
  case reflection[:type]
187
194
  when :one_to_many
188
195
  foreign_key = reflection[:key]
189
- db << "UPDATE #{reflection[:class].table_name} SET #{foreign_key} = #{to} WHERE #{foreign_key} = #{from}"
196
+ table = reflection.associated_class.table_name
190
197
  when :many_to_many
191
198
  foreign_key = reflection[:left_key]
192
- db << "UPDATE #{reflection[:join_table]} SET #{foreign_key} = #{to} WHERE #{foreign_key} = #{from}"
199
+ table = reflection[:join_table]
200
+ else
201
+ return
193
202
  end
203
+ db[table].filter(foreign_key=>from).update(foreign_key=>to)
194
204
  end
195
205
 
196
206
  # Remove the associated object from object's association
metadata CHANGED
@@ -1,33 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: scaffolding_extensions
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.1.3
7
- date: 2008-04-29 00:00:00 -07:00
8
- summary: Administrative database front-end for multiple web-frameworks and ORMs
9
- require_paths:
10
- - lib
11
- email: code@jeremyevans.net
12
- homepage:
13
- rubyforge_project: scaffolding-ext
14
- description:
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.1.4
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Jeremy Evans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-06-11 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: code@jeremyevans.net
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
31
24
  files:
32
25
  - LICENSE
33
26
  - README
@@ -35,45 +28,44 @@ files:
35
28
  - lib/scaffolding_extensions
36
29
  - lib/scaffolding_extensions/controller.rb
37
30
  - lib/scaffolding_extensions/controller
31
+ - lib/scaffolding_extensions/controller/action_controller.rb
32
+ - lib/scaffolding_extensions/controller/camping.rb
33
+ - lib/scaffolding_extensions/controller/ramaze.rb
34
+ - lib/scaffolding_extensions/controller/sinatra.rb
38
35
  - lib/scaffolding_extensions/helper.rb
39
36
  - lib/scaffolding_extensions/jquery_helper.rb
40
37
  - lib/scaffolding_extensions/meta_controller.rb
41
38
  - lib/scaffolding_extensions/meta_model.rb
42
39
  - lib/scaffolding_extensions/model.rb
43
40
  - lib/scaffolding_extensions/model
44
- - lib/scaffolding_extensions/overridable.rb
45
- - lib/scaffolding_extensions/prototype_helper.rb
46
- - lib/scaffolding_extensions/controller/action_controller.rb
47
- - lib/scaffolding_extensions/controller/camping.rb
48
- - lib/scaffolding_extensions/controller/ramaze.rb
49
- - lib/scaffolding_extensions/controller/sinatra.rb
50
41
  - lib/scaffolding_extensions/model/active_record.rb
51
42
  - lib/scaffolding_extensions/model/ardm.rb
52
43
  - lib/scaffolding_extensions/model/data_mapper.rb
53
44
  - lib/scaffolding_extensions/model/sequel.rb
45
+ - lib/scaffolding_extensions/overridable.rb
46
+ - lib/scaffolding_extensions/prototype_helper.rb
54
47
  - doc/advanced.txt
55
48
  - doc/camping.txt
56
49
  - doc/controller_spec.txt
57
50
  - doc/conversion.txt
58
51
  - doc/model_spec.txt
59
52
  - doc/ramaze.txt
60
- - doc/sequel.txt
61
53
  - doc/sinatra.txt
62
54
  - doc/testing.txt
63
55
  - contrib/scaffold_associations_tree
64
- - contrib/scaffold_auto_complete_style
65
- - contrib/scaffold_form_focus
66
- - contrib/scaffold_jquery_autocomplete
67
56
  - contrib/scaffold_associations_tree/README
68
57
  - contrib/scaffold_associations_tree/bullet.gif
69
58
  - contrib/scaffold_associations_tree/minus.gif
70
59
  - contrib/scaffold_associations_tree/plus.gif
71
60
  - contrib/scaffold_associations_tree/scaffold_associations_tree.css
72
61
  - contrib/scaffold_associations_tree/scaffold_associations_tree.js
62
+ - contrib/scaffold_auto_complete_style
73
63
  - contrib/scaffold_auto_complete_style/README
74
64
  - contrib/scaffold_auto_complete_style/auto_complete.css
65
+ - contrib/scaffold_form_focus
75
66
  - contrib/scaffold_form_focus/README
76
67
  - contrib/scaffold_form_focus/scaffold_form_focus.js
68
+ - contrib/scaffold_jquery_autocomplete
77
69
  - contrib/scaffold_jquery_autocomplete/README
78
70
  - contrib/scaffold_jquery_autocomplete/jquery.ui.se_autocomplete.css
79
71
  - contrib/scaffold_jquery_autocomplete/jquery.ui.se_autocomplete.js
@@ -89,20 +81,34 @@ files:
89
81
  - scaffolds/search.rhtml
90
82
  - scaffolds/show.rhtml
91
83
  - test/scaffolding_extensions_test.rb
92
- test_files: []
93
-
84
+ has_rdoc: true
85
+ homepage:
86
+ post_install_message:
94
87
  rdoc_options:
95
88
  - --inline-source
96
89
  - --line-numbers
97
90
  - README
98
91
  - lib
99
- extra_rdoc_files: []
100
-
101
- executables: []
102
-
103
- extensions: []
104
-
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: "0"
99
+ version:
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: "0"
105
+ version:
105
106
  requirements: []
106
107
 
107
- dependencies: []
108
+ rubyforge_project: scaffolding-ext
109
+ rubygems_version: 1.0.1
110
+ signing_key:
111
+ specification_version: 2
112
+ summary: Administrative database front-end for multiple web-frameworks and ORMs
113
+ test_files: []
108
114
 
data/doc/sequel.txt DELETED
@@ -1,4 +0,0 @@
1
- Sequel is fully supported by Scaffolding Extensions, but because Sequel provides
2
- limited reflection abilities for database columns, you should define
3
- @scaffold_column_types for each model and have entries in it for all columns
4
- that are not strings.