scaffolding_extensions 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -24,11 +24,11 @@ Scaffolding Extensions currently supports:
24
24
  * Rails 2.0
25
25
  * Ramaze 0.3.9.5
26
26
  * Camping 1.5
27
- * Sinatra 0.2.0
27
+ * Sinatra 0.2.2
28
28
  * Object/Relational Mappers
29
29
  * ActiveRecord 2.0
30
- * DataMapper 0.3.0
31
- * Sequel 1.4.0
30
+ * DataMapper 0.3.1
31
+ * Sequel 1.5.0
32
32
  * Javascript Libaries (used for Ajax/Autocompleting)
33
33
  * Prototype 1.6.0.1
34
34
  * JQuery 1.2.3
@@ -48,7 +48,7 @@ You can get Scaffolding Extensions via git or as a gem:
48
48
  * git: git://github.com/jeremyevans/scaffolding_extensions.git
49
49
  * gem: sudo gem install scaffolding_extensions
50
50
  * demo: http://scaffolding-extensions.jeremyevans.net
51
- * github: http://github.com/jeremyevans/scaffolding_extensions/tree/master
51
+ * github: http://github.com/jeremyevans/scaffolding_extensions
52
52
  * RDoc: http://code.jeremyevans.net/doc/scaffolding_extensions
53
53
  * Bug Tracker: http://rubyforge.org/tracker/?atid=22169&group_id=5726&func=browse
54
54
  * Forum: http://rubyforge.org/forum/forum.php?forum_id=22403
@@ -153,12 +153,6 @@ class Sinatra::EventContext
153
153
  include ScaffoldingExtensions::TextRenderer
154
154
  end
155
155
 
156
- class NilClass
157
- def from_param
158
- nil
159
- end
160
- end
161
-
162
156
  def scaffold(root, model, options = {})
163
157
  scaffold_setup(root).send(:scaffold, model, options)
164
158
  end
@@ -286,6 +286,12 @@ module ScaffoldingExtensions::MetaModel
286
286
  @scaffold_human_name ||= scaffold_name.humanize
287
287
  end
288
288
 
289
+ # Which associations to include when querying for multiple objects.
290
+ # Can be set with an instance variable.
291
+ def scaffold_include(action = :default)
292
+ @scaffold_include
293
+ end
294
+
289
295
  # The name string to use in urls, defaults to name.underscore. Can be set with an
290
296
  # instance variable.
291
297
  def scaffold_name
@@ -537,6 +543,11 @@ module ScaffoldingExtensions::MetaModel
537
543
  attributes.reject{|k,v| !allowed_attributes.include?(k.to_s.split('(')[0])}
538
544
  end
539
545
 
546
+ # The associations to include when loading the association
547
+ def scaffold_include_association(association)
548
+ scaffold_associated_class(association).scaffold_include(:association)
549
+ end
550
+
540
551
  # Condition to ensure field is not NULL
541
552
  def scaffold_notnull_condition(field)
542
553
  ["#{scaffold_table_name}.#{field} IS NOT NULL"]
@@ -104,12 +104,6 @@ module ScaffoldingExtensions::MetaActiveRecord
104
104
  [reflection.klass, reflection.primary_key_name, reflection.association_foreign_key, reflection.options[:join_table]]
105
105
  end
106
106
 
107
- # Which associations to include when querying for multiple objects.
108
- # Can be set with an instance variable.
109
- def scaffold_include(action = :default)
110
- @scaffold_include
111
- end
112
-
113
107
  # Returns a hash of values to be used as url parameters on the link to create a new
114
108
  # :has_many associated object. Defaults to setting the foreign key field to the
115
109
  # record's primary key, and the STI type to this model's name, if :as is one of
@@ -144,11 +138,6 @@ module ScaffoldingExtensions::MetaActiveRecord
144
138
  end
145
139
 
146
140
  private
147
- # The associations to include when loading the association
148
- def scaffold_include_association(association)
149
- scaffold_associated_class(association).scaffold_include(:association)
150
- end
151
-
152
141
  # Updates associated records for a given reflection and from record to point to the
153
142
  # to record
154
143
  def scaffold_reflection_merge(reflection, from, to)
@@ -176,9 +165,4 @@ class ActiveRecord::Base
176
165
  extend ScaffoldingExtensions::MetaARDM
177
166
  extend ScaffoldingExtensions::MetaActiveRecord
178
167
  extend ScaffoldingExtensions::Overridable
179
- class << self
180
- extend ScaffoldingExtensions::MetaOverridable
181
- scaffold_override_methods(:add_associated_objects, :associated_objects, :association_find_object, :association_find_objects, :find_object, :find_objects, :new_associated_object_values, :remove_associated_objects, :save, :unassociated_objects, :filter_attributes)
182
- scaffold_override_iv_methods(:associated_human_name, :association_use_auto_complete, :fields, :include, :select_order, :attributes, :include_association, :select_order_association)
183
- end
184
168
  end
@@ -105,7 +105,6 @@ module ScaffoldingExtensions::MetaDataMapper
105
105
 
106
106
  # Retrieve multiple objects given a hash of options
107
107
  def scaffold_get_objects(options)
108
- options.delete(:include)
109
108
  options[:conditions] = scaffold_merge_conditions(options[:conditions])
110
109
  all(options)
111
110
  end
@@ -116,11 +115,6 @@ module ScaffoldingExtensions::MetaDataMapper
116
115
  [reflection.constant, reflection.left_foreign_key, reflection.right_foreign_key, reflection.join_table]
117
116
  end
118
117
 
119
- # DataMapper doesn't use includes, so this is always nil
120
- def scaffold_include(action = :default)
121
- nil
122
- end
123
-
124
118
  # Returns a hash of values to be used as url parameters on the link to create a new
125
119
  # :has_many associated object. Defaults to setting the foreign key field to the
126
120
  # record's primary key.
@@ -150,11 +144,6 @@ module ScaffoldingExtensions::MetaDataMapper
150
144
  end
151
145
 
152
146
  private
153
- # DataMapper doesn't need to include, so this is always nil
154
- def scaffold_include_association(association)
155
- nil
156
- end
157
-
158
147
  # Updates associated records for a given reflection and from record to point to the
159
148
  # to record
160
149
  def scaffold_reflection_merge(reflection, from, to)
@@ -182,9 +171,4 @@ class DataMapper::Base
182
171
  extend ScaffoldingExtensions::MetaARDM
183
172
  extend ScaffoldingExtensions::MetaDataMapper
184
173
  extend ScaffoldingExtensions::Overridable
185
- class << self
186
- extend ScaffoldingExtensions::MetaOverridable
187
- scaffold_override_methods(:add_associated_objects, :associated_objects, :association_find_object, :association_find_objects, :find_object, :find_objects, :new_associated_object_values, :remove_associated_objects, :save, :unassociated_objects, :filter_attributes)
188
- scaffold_override_iv_methods(:associated_human_name, :association_use_auto_complete, :fields, :select_order, :attributes, :select_order_association)
189
- end
190
174
  end
@@ -129,6 +129,7 @@ module ScaffoldingExtensions::MetaSequel
129
129
  else records.order(o)
130
130
  end
131
131
  end
132
+ records = records.eager(options[:include]) if options[:include]
132
133
  records = records.limit(options[:limit], options[:offset]) if options[:limit]
133
134
  records.all
134
135
  end
@@ -139,11 +140,6 @@ module ScaffoldingExtensions::MetaSequel
139
140
  [reflection[:class], reflection[:left_key], reflection[:right_key], reflection[:join_table]]
140
141
  end
141
142
 
142
- # Sequel doesn't do eager loading yet, so this is always nil
143
- def scaffold_include(action = :default)
144
- nil
145
- end
146
-
147
143
  # Returns a hash of values to be used as url parameters on the link to create a new
148
144
  # :has_many associated object. Defaults to setting the foreign key field to the
149
145
  # record's primary key.
@@ -184,11 +180,6 @@ module ScaffoldingExtensions::MetaSequel
184
180
  end
185
181
 
186
182
  private
187
- # Sequel doesn't do eager loading yet
188
- def scaffold_include_association(association)
189
- nil
190
- end
191
-
192
183
  # Updates associated records for a given reflection and from record to point to the
193
184
  # to record
194
185
  def scaffold_reflection_merge(reflection, from, to)
@@ -216,9 +207,4 @@ class Sequel::Model
216
207
  extend ScaffoldingExtensions::MetaModel
217
208
  extend ScaffoldingExtensions::MetaSequel
218
209
  extend ScaffoldingExtensions::Overridable
219
- class << self
220
- extend ScaffoldingExtensions::MetaOverridable
221
- scaffold_override_methods(:add_associated_objects, :associated_objects, :association_find_object, :association_find_objects, :find_object, :find_objects, :new_associated_object_values, :remove_associated_objects, :save, :unassociated_objects, :filter_attributes)
222
- scaffold_override_iv_methods(:associated_human_name, :association_use_auto_complete, :fields, :select_order, :attributes, :select_order_association)
223
- end
224
210
  end
@@ -1,5 +1,13 @@
1
1
  module ScaffoldingExtensions
2
2
  module Overridable
3
+ def self.extended(klass)
4
+ class << klass
5
+ extend ScaffoldingExtensions::MetaOverridable
6
+ scaffold_override_methods(:add_associated_objects, :associated_objects, :association_find_object, :association_find_objects, :find_object, :find_objects, :new_associated_object_values, :remove_associated_objects, :save, :unassociated_objects, :filter_attributes)
7
+ scaffold_override_iv_methods(:associated_human_name, :association_use_auto_complete, :fields, :include, :select_order, :attributes, :include_association, :select_order_association)
8
+ end
9
+ end
10
+
3
11
  private
4
12
  # If a method exists matches scaffold_#{action}_#{m}, return a proc that calls it.
5
13
  # If not and the instance variable @scaffold_#{action}_#{m} is defined, return a
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: scaffolding_extensions
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.2
7
- date: 2008-04-15 00:00:00 -07:00
6
+ version: 1.1.3
7
+ date: 2008-04-29 00:00:00 -07:00
8
8
  summary: Administrative database front-end for multiple web-frameworks and ORMs
9
9
  require_paths:
10
10
  - lib