<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,12 +1,3 @@
-* API change: save_resource deprecated
-
-  So save_resource is now deprecated, just use resource.save
-  
-  resource_saved? has slightly different semantics - it returns true if the record is not new and has no errors
-  
-  WTF?: save_resource used to set an instance var to track whether the resource was saved.  This is so that
-        controller can make decisions based on this outside the scope of an action (in response_for, and after_filters)
-  
 * rspec compat:  Added new rake task to test that an RC controller passes the default rspec_scaffold
   controller specs.
 </diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,6 @@ resources_controller works with rails 2.x and edge.
 
 * The SPECDOC lists the specifications
 * Coverage is 100% (C0), and the spec suite is quite comprehensive
-* Rspec's generated rspec_scaffold controller specs are tested against a simple rc controller (see rake spec:generate)
 
 RSpec is used for testing, so the tests are in &lt;tt&gt;spec/&lt;/tt&gt; rather than
 &lt;tt&gt;test/&lt;/tt&gt; Do rake --tasks for more details.</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -60,7 +60,7 @@ Rake::RDocTask.new(:doc) do |t|
   t.title    = &quot;#{plugin_name}&quot;
   t.template = ENV['RDOC_TEMPLATE']
   t.options  = ['--line-numbers', '--inline-source', '--all']
-  t.rdoc_files.include('README.rdoc', 'SPECDOC', 'MIT-LICENSE', 'CHANGELOG')
+  t.rdoc_files.include('README', 'SPECDOC', 'MIT-LICENSE', 'CHANGELOG')
   t.rdoc_files.include('lib/**/*.rb')
 end
 </diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -575,25 +575,6 @@ Requesting /forums/2/owner using DELETE
 - should set the flash notice
 - should redirect to forums/2
 
-CommentsController#resource_saved Comment.new(&lt;invalid attrs&gt;)
-- should not be resource saved
-
-CommentsController#resource_saved Comment.new(&lt;invalid attrs&gt;).save
-- should not be resource saved
-
-CommentsController#resource_saved Comment.new(&lt;invalid attrs&gt;).save then update_attributes(&lt;valid attrs&gt;)
-- should be resource saved
-
-CommentsController#resource_saved Comment.find(&lt;id&gt;)
-- should be resource saved
-- .save should be saved
-
-CommentsController#resource_saved Comment.find(&lt;id&gt;) then update_attributes(&lt;invalid attrs&gt;)
-- should not be resource saved
-
-CommentsController#resource_saved Comment.find(&lt;id&gt;) then update_attributes(&lt;new valid attrs&gt;)
-- should be resource saved
-
 Routing shortcuts for Tags should map
 - resources_path to /tags
 - resource_path to /tags/2
@@ -811,6 +792,12 @@ Helper#form_for_resource (when resource is existing record)
 Helper#remote_form_for_resource (when resource is existing record)
 - should call remote_form_for with update form options
 
+ResourcesController.load_enclosing_resources_filter_exists? when :find_filter defined
+- should call :find_filter with :load_enclosing_resources
+
+ResourcesController.load_enclosing_resources_filter_exists? when :find_filter not defined
+- should call :filter_chain
+
 #load_enclosing_resources for resources_controller_for :tags (when route_enclosing_names is [['users', false]])
 - should call load_wildcard once
 - should call Specification.new('user', :singleton =&gt; false, :as =&gt; nil)
@@ -852,12 +839,6 @@ Helper#remote_form_for_resource (when resource is existing record)
 - should call load_enclosing_resource_from_specification with user spec, then load_wildcard once with 'taggable'
 - should call Specification.new with ('comment', :singleton =&gt; false, :as =&gt; 'taggable')
 
-ResourcesController.load_enclosing_resources_filter_exists? when :find_filter defined
-- should call :find_filter with :load_enclosing_resources
-
-ResourcesController.load_enclosing_resources_filter_exists? when :find_filter not defined
-- should call :filter_chain
-
 ResourcesController (in general)
 - nested_in :foo, :polymorphic =&gt; true, :class =&gt; User should raise argument error (no options or block with polymorphic)
 - resources_controller_for :forums, :in =&gt; [:user, '*', '*', :comment] should raise argument error (no multiple wildcards in a row)
@@ -868,9 +849,6 @@ ResourcesController#enclosing_resource_name
 A controller's resource_service
 - may be explicitly set with #resource_service=
 
-deprecated methods
-- #save_resource should send resource.save
-
 #route_enclosing_names TagsController for named_route:
 - :tags should be []
 - :new_tag should be []
@@ -892,6 +870,6 @@ deprecated methods
 #route_enclosing_names Admin::Superduper::ForumsController for named_route:
 - :admin_superduper_forums should be []
 
-Finished in 8.299069 seconds
+Finished in 5.097926 seconds
 
-601 examples, 0 failures
+593 examples, 0 failures</diff>
      <filename>SPECDOC</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,8 @@ garlic do
   
     run do
       cd &quot;vendor/plugins/resources_controller&quot; do
-        sh &quot;rake spec:rcov:verify &amp;&amp; rake spec:generate&quot;
+        sh &quot;rake spec:rcov:verify&quot;
+        sh &quot;rake spec:generate&quot;
       end
     end
   end</diff>
      <filename>garlic_example.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,3 @@
 require 'ardes/resources_controller'
+
 ActionController::Base.extend Ardes::ResourcesController
\ No newline at end of file</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -665,18 +665,18 @@ module Ardes#:nodoc:
         @enclosing_collection_resources ||= []
       end
       
-      # Has the resource been saved?
+      # Returns self.resource.save and caches the result for future calls.
+      # This is useful when you want to know outside of an action whether the resource was saved.
       #
-      # Returns true if the record is not new, and there are no errors
-      def resource_saved?
-        !resource.new_record? &amp;&amp; resource.errors.empty?
+      # Pass true to ignore the cached value
+      def resource_saved?(reload = false)
+        save_resource if reload || @resource_saved.nil?
+        @resource_saved
       end
       
-      # DEPRECATED: just use resource.save
       def save_resource
-        resource.save
+        @resource_saved = resource.save
       end
-      deprecate :save_resource =&gt; 'Use resource.save'
       
     private
       # returns the route that was used to invoke this controller and current action.  The path is found first from params[:resource_path]</diff>
      <filename>lib/ardes/resources_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -93,9 +93,9 @@ module Ardes#:nodoc:
       # POST /events.xml
       def create
         self.resource = new_resource
-        
+
         respond_to do |format|
-          if resource.save
+          if resource_saved?
             format.html do
               flash[:notice] = &quot;#{resource_name.humanize} was successfully created.&quot;
               redirect_to resource_url
@@ -114,9 +114,10 @@ module Ardes#:nodoc:
       # PUT /events/1.xml
       def update
         self.resource = find_resource
-        
+        resource.attributes = params[resource_name]
+
         respond_to do |format|
-          if resource.update_attributes(params[resource_name])
+          if resource_saved?
             format.html do
               flash[:notice] = &quot;#{resource_name.humanize} was successfully updated.&quot;
               redirect_to resource_url</diff>
      <filename>lib/ardes/resources_controller/actions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,13 +156,12 @@ class Post &lt; ActiveRecord::Base
 end
 
 class Comment &lt; ActiveRecord::Base
-  validates_presence_of :user, :post
-  
   belongs_to :user
   belongs_to :post
   has_many :tags, :as =&gt; :taggable
 end
 
+
 ##############
 # Controllers
 ##############</diff>
      <filename>spec/app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -309,7 +309,7 @@ describe &quot;Requesting /users/dave/addresses/1 using PUT&quot; do
   end
 
   it &quot;should update the found address&quot; do
-    @address.should_receive(:update_attributes).and_return(true)
+    @address.should_receive(:attributes=)
     do_update
   end
 </diff>
      <filename>spec/controllers/addresses_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -522,7 +522,7 @@ describe &quot;Requesting /admin/forums/1 using PUT&quot; do
   end
 
   it &quot;should update the found forum&quot; do
-    @mock_forum.should_receive(:update_attributes).and_return(true)
+    @mock_forum.should_receive(:attributes=)
     do_update
     assigns(:forum).should == @mock_forum
   end
@@ -558,7 +558,7 @@ describe &quot;Requesting /admin/forums/1 using XHR PUT&quot; do
   end
 
   it &quot;should update the found forum&quot; do
-    @mock_forum.should_receive(:update_attributes).and_return(true)
+    @mock_forum.should_receive(:attributes=)
     do_update
     assigns(:forum).should == @mock_forum
   end
@@ -579,7 +579,7 @@ describe &quot;Requesting /admin/forums/1 using XHR PUT&quot; do
   end
   
   it &quot;should render edit.rjs, on unsuccessful save&quot; do
-    @mock_forum.stub!(:update_attributes).and_return(false)
+    @mock_forum.stub!(:save).and_return(false)
     do_update
     response.should render_template('edit')
   end</diff>
      <filename>spec/controllers/admin_forums_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -77,7 +77,7 @@ describe &quot;resource_service in CommentsController&quot; do
   before(:each) do
     @forum          = Forum.create
     @post           = Post.create :forum_id =&gt; @forum.id
-    @comment        = Comment.create :post_id =&gt; @post.id, :user =&gt; User.create
+    @comment        = Comment.create :post_id =&gt; @post.id
     @other_post     = Post.create :forum_id =&gt; @forum.id
     @other_comment  = Comment.create :post_id =&gt; @other_post.id
     
@@ -342,7 +342,7 @@ describe &quot;Requesting /forums/3/posts/3/comments/1 using PUT&quot; do
   end
 
   it &quot;should update the found comment&quot; do
-    @comment.should_receive(:update_attributes).and_return(true)
+    @comment.should_receive(:attributes=)
     do_update
   end
 </diff>
      <filename>spec/controllers/comments_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -395,7 +395,7 @@ describe &quot;Requesting /forums/2/posts/1 using PUT&quot; do
   end
 
   it &quot;should update the found post&quot; do
-    @post.should_receive(:update_attributes)
+    @post.should_receive(:attributes=)
     do_update
   end
 </diff>
      <filename>spec/controllers/forum_posts_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -599,7 +599,7 @@ describe &quot;Requesting /forums/1 using PUT&quot; do
   end
 
   it &quot;should update the found forum&quot; do
-    @mock_forum.should_receive(:update_attributes)
+    @mock_forum.should_receive(:attributes=)
     do_update
     assigns(:forum).should == @mock_forum
   end
@@ -635,7 +635,7 @@ describe &quot;Requesting /forums/1 using XHR PUT&quot; do
   end
 
   it &quot;should update the found forum&quot; do
-    @mock_forum.should_receive(:update_attributes)
+    @mock_forum.should_receive(:attributes=)
     do_update
     assigns(:forum).should == @mock_forum
   end
@@ -656,7 +656,7 @@ describe &quot;Requesting /forums/1 using XHR PUT&quot; do
   end
   
   it &quot;should render edit.rjs, on unsuccessful save&quot; do
-    @mock_forum.stub!(:update_attributes).and_return(false)
+    @mock_forum.stub!(:save).and_return(false)
     do_update
     response.should render_template('edit')
   end</diff>
      <filename>spec/controllers/forums_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,9 +52,10 @@ describe InfosController, &quot; (its actions)&quot; do
   end
   
   it &quot;PUT /account/info should be successful&quot; do
-    @info.stub!(:update_attributes).and_return(true)
+    @info.stub!(:attributes=)
+    @info.stub!(:save)
     put :update
-    response.should be_redirect
+    response.should be_success
   end
   
   it &quot;GET /account/info/new should raise UnknownAction&quot; do</diff>
      <filename>spec/controllers/infos_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -220,7 +220,8 @@ describe &quot;Requesting /forums/2/owner using PUT&quot; do
 
   before(:each) do
     setup_mocks
-    @owner.stub!(:update_attributes).and_return(true)
+    @owner.stub!(:save).and_return(true)
+    @owner.stub!(:attributes=)
   end
   
   def do_update
@@ -238,7 +239,7 @@ describe &quot;Requesting /forums/2/owner using PUT&quot; do
   end
 
   it &quot;should update the owner&quot; do
-    @owner.should_receive(:update_attributes).with('name' =&gt; 'Fred')
+    @owner.should_receive(:attributes=).with('name' =&gt; 'Fred')
     do_update
   end
 </diff>
      <filename>spec/controllers/owners_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -71,7 +71,7 @@ describe &quot;resource_service in TagsController via Forum, Post and Comment&quot; do
   before(:each) do
     @forum         = Forum.create
     @post          = Post.create :forum_id =&gt; @forum.id
-    @comment       = Comment.create :post_id =&gt; @post.id, :user =&gt; User.create!
+    @comment       = Comment.create :post_id =&gt; @post.id
     @tag           = Tag.create :taggable_id =&gt; @comment.id, :taggable_type =&gt; 'Comment'
     @other_comment = Comment.create :post_id =&gt; @forum.id
     @other_tag     = Tag.create :taggable_id =&gt; @other_comment.id, :taggable_type =&gt; 'Comment'</diff>
      <filename>spec/controllers/tags_controller_via_forum_post_comment_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -235,12 +235,14 @@ describe UsersController, &quot;handling PUT /users/dave&quot; do
   end
   
   def put_with_successful_update
-    @user.should_receive(:update_attributes).and_return(true)
+    @user.should_receive(:attributes=).once.ordered
+    @user.should_receive(:save).once.ordered.and_return(true)
     put :update, :id =&gt; &quot;dave&quot;
   end
   
   def put_with_failed_update
-    @user.should_receive(:update_attributes).and_return(false)
+    @user.should_receive(:attributes=).once.ordered
+    @user.should_receive(:save).once.ordered.and_return(false)
     put :update, :id =&gt; &quot;dave&quot;
   end
   </diff>
      <filename>spec/controllers/users_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,18 +40,4 @@ describe &quot;A controller's resource_service&quot; do
     @controller.resource_service = 'foo'
     @controller.resource_service.should == 'foo'
   end
-end
-
-describe &quot;deprecated methods&quot; do
-  before do 
-    @controller = ForumsController.new
-    @controller.resource = Forum.new
-  end
-  
-  it &quot;#save_resource should send resource.save&quot; do
-    ActiveSupport::Deprecation.silence do
-      @controller.resource.should_receive :save
-      @controller.save_resource
-    end
-  end
 end
\ No newline at end of file</diff>
      <filename>spec/specs/resources_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>spec/controllers/resource_saved_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>2a6493b1f7b812aa4da7c1c8d6a97a9667296ba5</id>
    </parent>
  </parents>
  <author>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </author>
  <url>http://github.com/ianwhite/resources_controller/commit/c21f35c35ef71576c99d412bc562ab10278c652b</url>
  <id>c21f35c35ef71576c99d412bc562ab10278c652b</id>
  <committed-date>2008-09-12T03:27:32-07:00</committed-date>
  <authored-date>2008-09-12T03:27:32-07:00</authored-date>
  <message>Reverted 2f49687, 7423cf1 (save_resource and resource_saved? stuff) because of aberrant behaviour.
Will add them back in with some extra specs.  [Jason Lee]</message>
  <tree>aa15e604404d44822bb39593e15322e530e62582</tree>
  <committer>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </committer>
</commit>
