<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test_site/ar_garbage.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -22,13 +22,13 @@ Scaffolding Extensions currently supports:
 
 * Web Frameworks
   * Rails 2.3.2
-  * Ramaze 2009.02
+  * Ramaze 2009.06.04
   * Camping 1.5
   * Sinatra 0.9.2
   * Merb 1.0.4
 * Object Relational Mappers
   * ActiveRecord 2.3.2
-  * Sequel 3.0.0
+  * Sequel 3.1.0
 * Javascript Libaries (used for Ajax/Autocompleting)
   * Prototype 1.6.0.3
   * JQuery 1.2.3</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,3 @@ controllers have been loaded.
 
 Also, note that Scaffolding Extensions uses the :Erubis engine in Ramaze,
 so you must have Erubis installed to use it.
-
-Scaffolding Extensions currently does not support Ramaze 2009.04+ (the
-versions based on Innate).  A patch that gives partial support is
-available at http://pastie.org/484442.</diff>
      <filename>doc/ramaze.txt</filename>
    </modified>
    <modified>
      <diff>@@ -7,17 +7,6 @@ module ScaffoldingExtensions
         scaffold_method_not_allowed if scaffolded_nonidempotent_method?(scaffold_request_action) &amp;&amp; scaffold_request_method != 'POST'
       end
       
-      # Force the given value into an array.  If the items is currently an array,
-      # return it.  If the item is nil or false, return the empty array.  Otherwise,
-      # return an array with the value as the only member.
-      def scaffold_force_array(value)
-        if value
-          Array === value ? value : [value]
-        else
-          []
-        end
-      end
-      
       # Returns path to the given scaffold template file
       def scaffold_path(template_name)
         File.join(self.class.scaffold_template_dir, &quot;#{template_name}.rhtml&quot;)
@@ -58,7 +47,7 @@ module ScaffoldingExtensions
       # Converts the value to an array, converts all values of the array to integers,
       # removes all 0 values, and returns the array.
       def scaffold_select_ids(value)
-        scaffold_force_array(value).collect{|x| x.to_i}.delete_if{|x| x == 0}
+        Array(value).collect{|x| x.to_i}.delete_if{|x| x == 0}
       end
 
       # Set the notice entry in the scaffold_flash hash by default.</diff>
      <filename>lib/scaffolding_extensions/controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,12 +11,6 @@ module ScaffoldingExtensions
   # Helper methods for ActionController::Base that override the defaults in Scaffolding Extensions
   module ActionControllerHelper
     private
-      # ActionController::Base requires that params that are desired to be lists have
-      # the suffix '[]'
-      def scaffold_param_list_suffix
-        '[]'
-      end
-      
       # ActionController::Base allows easy access to the CSRF token via token_tag
       def scaffold_token_tag
         token_tag</diff>
      <filename>lib/scaffolding_extensions/controller/action_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -288,7 +288,7 @@ module ScaffoldingExtensions
       
       # The suffix needed to params that should be lists.  The empty string by default.
       def scaffold_param_list_suffix
-        ''
+        '[]'
       end
       
       # A select tag with the provided name for the given collection of items. The options</diff>
      <filename>lib/scaffolding_extensions/helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -149,7 +149,7 @@ module ScaffoldingExtensions
             page = scaffold_request_param(:page).to_i &gt; 1 ? scaffold_request_param(:page).to_i : 1
             page -= 1 if scaffold_request_param(:page_previous)
             page += 1 if scaffold_request_param(:page_next)
-            @scaffold_search_results_form_params, @scaffold_objects = klass.scaffold_search(:model=&gt;scaffold_request_param(singular_name), :notnull=&gt;scaffold_force_array(scaffold_request_param(:notnull)), :null=&gt;scaffold_force_array(scaffold_request_param(:null)), :page=&gt;page, :session=&gt;scaffold_session)
+            @scaffold_search_results_form_params, @scaffold_objects = klass.scaffold_search(:model=&gt;scaffold_request_param(singular_name), :notnull=&gt;Array(scaffold_request_param(:notnull)), :null=&gt;Array(scaffold_request_param(:null)), :page=&gt;page, :session=&gt;scaffold_session)
             @scaffold_listtable_type = :search
             scaffold_render_template(:listtable, scaffold_options)
           end</diff>
      <filename>lib/scaffolding_extensions/meta_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -126,11 +126,8 @@ module ScaffoldingExtensions::MetaModel
   def scaffold_add_associated_objects(association, object, options, *associated_object_ids)
     unless associated_object_ids.empty?
       scaffold_transaction do
-        associated_objects = associated_object_ids.collect do |associated_object_id|
-          associated_object = scaffold_association_find_object(association, associated_object_id.to_i, :session=&gt;options[:session])
-          scaffold_add_associated_object(association, object, associated_object)
-          associated_object
-        end
+        associated_objects = associated_object_ids.map{|i| scaffold_association_find_object(association, i.to_i, :session=&gt;options[:session])}
+        associated_objects.each{|o| scaffold_add_associated_object(association, object, o)}
         associated_object_ids.length == 1 ? associated_objects.first : associated_objects
       end
     end</diff>
      <filename>lib/scaffolding_extensions/meta_model.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,12 +16,11 @@ end
 # Class methods added to ActiveRecord::Base to allow it to work with Scaffolding Extensions.
 module ScaffoldingExtensions::MetaActiveRecord
   SCAFFOLD_OPTIONS = ::ScaffoldingExtensions::MetaModel::SCAFFOLD_OPTIONS
-
+  
   # Add the associated object to the object's association
   def scaffold_add_associated_object(association, object, associated_object)
     association_proxy = object.send(association)
-    return if association_proxy.include?(associated_object)
-    association_proxy &lt;&lt; associated_object
+    association_proxy &lt;&lt; associated_object unless association_proxy.include?(associated_object)
   end
 
   # Array of all association reflections for this model</diff>
      <filename>lib/scaffolding_extensions/model/active_record.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@ module ScaffoldingExtensions::MetaSequel
   
   # Add the associated object to the object's association
   def scaffold_add_associated_object(association, object, associated_object)
-    object.send(association_reflection(association).add_method, associated_object)
+    object.send(association_reflection(association).add_method, associated_object) unless object.send(association).include?(associated_object)
   end
 
   # Array of all association reflections for this model</diff>
      <filename>lib/scaffolding_extensions/model/sequel.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,11 @@
 class ActiveRecordController &lt; Ramaze::Controller
   map '/active_record'
-  helper :aspect
-  after_all{ActiveRecord::Base.clear_active_connections!}
   scaffold ArOfficer
   scaffold ArMeeting
   scaffold_all_models :only=&gt;[ArEmployee, ArGroup, ArPosition]
 end
 
-class ASequelController &lt; Ramaze::Controller
+class SequelController &lt; Ramaze::Controller
   map '/sequel'
   scaffold SqOfficer
   scaffold SqMeeting</diff>
      <filename>test_site/controller/main.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@
 require 'rubygems'
 SE_TEST_FRAMEWORK='sinatra'
 require 'sinatra/base'
+require 'ar_garbage'
 
 class Sinatra::Base
   set(:environment=&gt;:production, :app_file=&gt;'sinatra_se_sq', :raise_errors=&gt;true, :logging=&gt;true, :views=&gt;'blah')
@@ -30,17 +31,6 @@ class ActiveRecordController &lt; Sinatra::Base
   scaffold_all_models :only=&gt;[ArEmployee, ArGroup, ArPosition]
 end
 
-class CleanUpARGarbage
-  def initialize(app, opts={})
-    @app = app
-  end
-  def call(env)
-    res = @app.call(env)
-    ActiveRecord::Base.clear_active_connections!
-    res
-  end
-end
-
 app = Rack::Builder.app do
   map &quot;/sequel&quot; do
     run SequelController</diff>
      <filename>test_site/sinatra_se.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@ require 'active_record_setup'
 require 'sequel_setup'
 require 'se_setup'
 require 'controller/main'
+require 'ar_garbage'
 
 #Ramaze::Inform.loggers = []
-Ramaze.start(:adapter =&gt; :mongrel, :port =&gt; 7978, :mode =&gt; :live)
+Ramaze.start(:adapter =&gt; :mongrel, :port =&gt; 7978, :mode =&gt; :live){|m| m.use CleanUpARGarbage; m.run Ramaze::AppMap}</diff>
      <filename>test_site/start.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>924e389b22106677ac04c0958e46a5754a991def</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Evans</name>
    <email>code@jeremyevans.net</email>
  </author>
  <url>http://github.com/jeremyevans/scaffolding_extensions/commit/79f9f63794ba0977fb6ea5df1aee07ee31bc1295</url>
  <id>79f9f63794ba0977fb6ea5df1aee07ee31bc1295</id>
  <committed-date>2009-06-11T11:00:55-07:00</committed-date>
  <authored-date>2009-06-11T11:00:55-07:00</authored-date>
  <message>Support Ramaze 2009.06.04

Make scaffolding_extensions fully support the Innate-based versions
of Ramaze.  Unfortunately, full support requires a change just
made to the git version of Innate, but it should be mostly working
even on the gem version.

Change the code so that all frameworks use [] as a suffix for
parameters that should be a list.  This apparently is backwards
compatible, and is required when using rack 1.0.0 (which ramaze
indirectly depends on).

Refactor scaffold_add_associated_objects and makes sure that
associated objects don't get added multiple times when using
Sequel.

Remove scaffold_force_array, since it just duplicates the
Kernel#Array method poorly.

Move the CleanUpARGarbage middleware into a separate file that
can be used by both Ramaze and Sinatra, since Ramaze's after_all
block doesn't seem to work as before.

While here, bump supported Sequel version to 3.1.0.

The gem version isn't getting bumped yet, it will after a gem
version of Innate with the fix is released.</message>
  <tree>593960d67a1bdd388c5ab85b9d8ea153e6782584</tree>
  <committer>
    <name>Jeremy Evans</name>
    <email>code@jeremyevans.net</email>
  </committer>
</commit>
