Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The reason for the reversion in c21f35c has been fixed. Thanks Jason …
…Lee for the bug report. The problem was that I had changed resource_saved?'s behaviour to *not* saving the model if it had already been saved. In the future resource_saved? will be deprecated, but not yet. BTW. All of these changes to resource_saved? behaviour is aimed at making RC drop in compatible with rspec's generated controller specs (try rake spec:generate). To do that I need the default update action to use :update_attributes. This meant that the old strategy of keeping track of saves by using save_resource wont work. Instead, we keep track by looking at the AR's state (see lib/ardes/active_record/saved.rb) which is a far better solution anyway. Squashed commit of the following: commit f8a589f9b3711140fa7e125a42681acc1ad97e10 Author: Ian White <ian.w.white@gmail.com> Date: Sun Sep 14 05:21:23 2008 +1000 Docfixes, CHANGELOG, SPECDOC commit e670fd2e18678d94292bc684e57f8bf64a2e2dc9 Author: Ian White <ian.w.white@gmail.com> Date: Sun Sep 14 05:09:24 2008 +1000 Fixed logic error in AR.saved? commit b3e2838e1515503820e49eaf7853099df33a0d8e Author: Ian White <ian.w.white@gmail.com> Date: Sun Sep 14 05:05:29 2008 +1000 Adding specs for AR.saved? and AR.validation_attempted? commit 3e649c53d06a788b5e70878b2cb7e386571fce31 Author: Ian White <ian.w.white@gmail.com> Date: Sun Sep 14 04:56:56 2008 +1000 Fixed bug in init.rb commit c72b1a917339b7ee94700d8eb6b6bd939ad7e4b2 Author: Ian White <ian.w.white@gmail.com> Date: Sun Sep 14 04:56:28 2008 +1000 Fixed bug in init.rb commit d5702c06d8d54b80dd011f79ff3d2ac782ce902e Author: Ian White <ian.w.white@gmail.com> Date: Sun Sep 14 04:55:18 2008 +1000 Added AR.saved? & AR.validation_atempted? convenience methods. Returned save_resource?'s behaviour to that of saving the record if it has not had save attempted commit af11af7848811da5ca87efdd8eb678251c5bd6d5 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 09:58:15 2008 +1000 Added resource_saved? specs, and removed .first and .last for BC in specs to 2.0.x commit 5efb59f7c0fb8be72b12b5476291e59e6af658c0 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 09:57:30 2008 +1000 Added resource_saved? specs, and removed .first and .last for BC in specs to 2.0.x commit 8b73130de97ab87369ec395be4ee696de76e773a Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 09:46:52 2008 +1000 Small fix for comments_with_models spec commit 3a2426cd00fa945d155d4f3ebff6ccc48a7b0cf2 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 09:29:26 2008 +1000 Added specs for comments_controller which use real DB objects commit 79a93132f6e49a556775e6508a5773686ccd6332 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 06:27:51 2008 +1000 Fixing comments with models spec commit 05f551f5755e6db41a83dde0c9b0db99a4e168d8 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 06:24:19 2008 +1000 Added some controller specs with real models commit 6163aba8c5315598d173cd205bc2d69286ae4271 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 06:02:36 2008 +1000 Updated 2.1.x target commit b3c6d13a77aff7d831e136221ead8b7fa7bed4e1 Author: Ian White <ian.w.white@gmail.com> Date: Sat Sep 13 04:54:40 2008 +1000 Add resource_saved stuff back in (2f49687, 7423cf1) This reverts commit c21f35c.
- Loading branch information
Showing
23 changed files
with
438 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require 'ardes/resources_controller' | ||
ActionController::Base.extend Ardes::ResourcesController | ||
|
||
ActionController::Base.extend Ardes::ResourcesController | ||
require 'ardes/active_record/saved' | ||
ActiveRecord::Base.send :include, Ardes::ActiveRecord::Saved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Ardes | ||
module ActiveRecord | ||
module Saved | ||
# returns true if this record is not new, and has no errors | ||
def saved? | ||
!new_record? && (@errors.nil? || errors.empty?) | ||
end | ||
|
||
# returns true if this instance has had validation (maybe via save) attempted | ||
def validation_attempted? | ||
!@errors.nil? | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.