<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>generators/scaffold_resource/templates/rspec/functional_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/helper_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/routing_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/unit_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/views/edit_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/views/index_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/views/new_spec.rb</filename>
    </added>
    <added>
      <filename>generators/scaffold_resource/templates/rspec/views/show_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,6 +4,8 @@ module ResourceController
   NAME_ACCESSORS   = [:model_name, :route_name, :object_name]  
   
   module ActionControllerExtension
+    unloadable
+    
     def resource_controller(*args)
       include ResourceController::Controller
       
@@ -12,4 +14,4 @@ module ResourceController
       end
     end  
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/resource_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,8 @@ module ResourceController # :nodoc:
       
       def reader_writer(accessor_name)
         class_eval &lt;&lt;-&quot;end_eval&quot;, __FILE__, __LINE__
-          def #{accessor_name}(*args)
+          def #{accessor_name}(*args, &amp;block)
+            args &lt;&lt; block unless block.nil?
             @#{accessor_name} = args.first unless args.empty?
             @#{accessor_name}
           end</diff>
      <filename>lib/resource_controller/accessors.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,8 @@ module ResourceController
     extend ResourceController::Accessors
     
     reader_writer  :flash
+    reader_writer  :flash_now
+    
     block_accessor :after, :before
     
     def initialize
@@ -28,9 +30,10 @@ module ResourceController
     def dup
       returning self.class.new do |duplicate|
         duplicate.instance_variable_set(:@collector, wants.dup)
-        duplicate.instance_variable_set(:@before, before.dup) unless before.nil?
-        duplicate.instance_variable_set(:@after, after.dup) unless after.nil?
-        duplicate.instance_variable_set(:@flash, flash.dup) unless flash.nil?
+        duplicate.instance_variable_set(:@before, before.dup)       unless before.nil?
+        duplicate.instance_variable_set(:@after, after.dup)         unless after.nil?
+        duplicate.instance_variable_set(:@flash, flash.dup)         unless flash.nil?
+        duplicate.instance_variable_set(:@flash_now, flash_now.dup) unless flash_now.nil?
       end
     end
   end</diff>
      <filename>lib/resource_controller/action_options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,8 +15,8 @@ module ResourceController
         end
 
         self.helper_method :object_url, :edit_object_url, :new_object_url, :collection_url, :object, :collection, 
-                             :parent, :parent_type, :parent_object, :model_name, :model, :object_path, :edit_object_path,
-                              :new_object_path, :collection_path, :hash_for_collection_path, :hash_for_object_path, 
+                             :parent, :parent_type, :parent_object, :parent_model, :model_name, :model, :object_path, 
+                             :edit_object_path, :new_object_path, :collection_path, :hash_for_collection_path, :hash_for_object_path, 
                                 :hash_for_edit_object_path, :hash_for_new_object_path, :hash_for_collection_url, 
                                   :hash_for_object_url, :hash_for_edit_object_url, :hash_for_new_object_url, :parent?,
                                     :collection_url_options, :object_url_options, :new_object_url_options</diff>
      <filename>lib/resource_controller/controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,7 @@ module ResourceController
       @fails   = ActionOptions.new
     end
     
-    delegate :flash, :after, :response, :wants, :to =&gt; :success
+    delegate :flash, :flash_now, :after, :response, :wants, :to =&gt; :success
     
     def dup
       returning self.class.new do |duplicate|</diff>
      <filename>lib/resource_controller/failable_action_options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,10 +30,27 @@ module ResourceController::Helpers::Internal
       invoke_callbacks *self.class.send(action).before
     end
     
-    # Sets the flash for the action, if it is present.
+    # Sets the flash and flash_now for the action, if it is present.
     #
     def set_flash(action)
-      flash[:notice] = options_for(action).flash if options_for(action).flash
+      set_normal_flash(action)
+      set_flash_now(action)
+    end
+    
+    # Sets the regular flash (i.e. flash[:notice] = '...')
+    #
+    def set_normal_flash(action)
+      if f = options_for(action).flash
+        flash[:notice]     = f.is_a?(Proc) ? instance_eval(&amp;f) : options_for(action).flash
+      end
+    end
+    
+    # Sets the flash.now (i.e. flash.now[:notice] = '...')
+    #
+    def set_flash_now(action)
+      if f = options_for(action).flash_now
+        flash.now[:notice] = f.is_a?(Proc) ? instance_eval(&amp;f) : options_for(action).flash_now
+      end
     end
     
     # Returns the options for an action, which is a symbol.</diff>
      <filename>lib/resource_controller/helpers/internal.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,3 @@
 class Cms::ProductsController &lt; ResourceController::Base
+  create.flash 'something'
 end</diff>
      <filename>test/app/controllers/cms/products_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@ class PhotosController &lt; ResourceController::Base
   actions :all, :except =&gt; :update
   
   belongs_to :user
+  create.flash { &quot;#{@photo.title} was created!&quot; }
   
   private
     def parent_model</diff>
      <filename>test/app/controllers/photos_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,5 +18,6 @@ class Cms::ProductsControllerTest &lt; Test::Unit::TestCase
     resource.update.redirect  = 'cms_product_path(@product)'
     resource.destroy.redirect = 'cms_products_path'
     resource.create.redirect  = 'cms_product_path(@product)'
+    resource.create.flash     = /something/i
   end
 end</diff>
      <filename>test/test/functional/cms/products_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,9 +19,11 @@ class PhotosControllerTest &lt; Test::Unit::TestCase
   end
   
   should_be_restful do |resource|
-    resource.formats = [:html]
+    resource.formats       = [:html]
     
-    resource.actions = [:index, :new, :create, :destroy, :show, :edit]
+    resource.actions       = [:index, :new, :create, :destroy, :show, :edit]
+    resource.create.params = {:title =&gt; 'Some Photo Title'}
+    resource.create.flash  = &quot;Some Photo Title was created!&quot;
   end
   
   context &quot;with user as parent&quot; do</diff>
      <filename>test/test/functional/photos_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -88,4 +88,23 @@ class AccessorsTest &lt; Test::Unit::TestCase
       assert @controller.something[2].is_a?(Proc)
     end
   end
+  
+  context &quot;reader writer&quot; do
+    setup do
+      PostsController.class_eval do
+        reader_writer :rw
+      end
+      
+      @controller = PostsController.new
+    end
+
+    should &quot;store blocks&quot; do
+      @controller.rw do
+        &quot;asdf&quot;
+      end
+      
+      assert @controller.rw.is_a?(Proc), @controller.rw
+    end
+  end
+  
 end
\ No newline at end of file</diff>
      <filename>test/test/unit/accessors_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,14 +2,19 @@ require File.dirname(__FILE__)+'/../test_helper'
 
 class ActionOptionsTest &lt; Test::Unit::TestCase
   def setup
-    @controller     = PostsController.new
-    @create = ResourceController::ActionOptions.new
+    @controller = PostsController.new
+    @create     = ResourceController::ActionOptions.new
   end
   
   should &quot;have attr accessor for flash&quot; do
     @create.flash &quot;Successfully created.&quot;
     assert_equal &quot;Successfully created.&quot;, @create.flash
   end
+  
+  should &quot;have attr accessor for flash_now&quot; do
+    @create.flash_now &quot;Successfully created.&quot;
+    assert_equal &quot;Successfully created.&quot;, @create.flash_now
+  end
 
   %w(before after).each do |accessor|
     should &quot;have a block accessor for #{accessor}&quot; do
@@ -68,9 +73,10 @@ class ActionOptionsTest &lt; Test::Unit::TestCase
     setup do
       @opts = ResourceController::ActionOptions.new
       @opts.wants.js
-      @opts.after {}
-      @opts.before {}
-      @opts.flash ''
+      @opts.after     {}
+      @opts.before    {}
+      @opts.flash     ''
+      @opts.flash_now ''
       @dup = @opts.dup
     end
 
@@ -93,6 +99,11 @@ class ActionOptionsTest &lt; Test::Unit::TestCase
       assert !@opts.flash.equal?(@dup.flash)
       assert @dup.flash
     end
+    
+    should &quot;duplicate the flash_now&quot; do
+      assert !@opts.flash_now.equal?(@dup.flash_now)
+      assert @dup.flash_now
+    end
   end
   
 end</diff>
      <filename>test/test/unit/action_options_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -85,4 +85,22 @@ class Helpers::InternalTest &lt; Test::Unit::TestCase
       assert_equal @new_action, @controller.send(:options_for, :new_action)
     end
   end
+  
+  context &quot;flash now helper&quot; do
+    setup do
+      klass = Class.new do
+        include ResourceController::Helpers::Internal
+      end
+      
+      @c = klass.new
+      @c.stubs(:options_for).returns(stub(:flash_now =&gt; 'something'))
+      flash_now = mock()
+      flash_now.expects(:[]=).with(:notice, 'something')
+      @c.stubs(:flash).returns(stub(:now =&gt; flash_now))
+    end
+
+    should &quot;set the flash_now&quot; do
+      @c.send :set_flash_now, :new
+    end
+  end
 end</diff>
      <filename>test/test/unit/helpers/internal_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>31b278f4ae4ef0e33eab91f97f318dfb44553b75</id>
    </parent>
    <parent>
      <id>84a75ea5260b4c8cb4b7b75ac83f80d61d8a1a17</id>
    </parent>
  </parents>
  <author>
    <name>James Golick</name>
    <email>james@giraffesoft.ca</email>
  </author>
  <url>http://github.com/mattswell/resource_controller/commit/df29959181e1a4140ce0d0f8a50d81ffbe7b17b6</url>
  <id>df29959181e1a4140ce0d0f8a50d81ffbe7b17b6</id>
  <committed-date>2008-06-24T09:59:06-07:00</committed-date>
  <authored-date>2008-06-24T09:59:06-07:00</authored-date>
  <message>merge back from master</message>
  <tree>e68c68521489f6e3bf8eb2eeed2cad45d2d523af</tree>
  <committer>
    <name>James Golick</name>
    <email>james@giraffesoft.ca</email>
  </committer>
</commit>
