Created
December 10, 2008 19:04
-
-
Save bkaney/34441 to your computer and use it in GitHub Desktop.
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
Index: lib/plugins/acts_as_asset/lib/everyone.rb | |
=================================================================== | |
--- lib/plugins/acts_as_asset/lib/everyone.rb (revision 5414) | |
+++ lib/plugins/acts_as_asset/lib/everyone.rb (working copy) | |
@@ -17,11 +17,15 @@ | |
# in the database for 'Everyone' -- this will allow referential integrity to be maintained | |
# when ACL records reference 'Everyone' | |
Asset.connection.execute("INSERT INTO assets(id, asset_type) VALUES(#{ID},'Everyone')"); | |
+ # Sometimes within the context of a transaction, the finder was returning nil | |
+ # from the Everyone.find_by_id, so creating and object with the same data.... | |
+ @@instance = Everyone.find_by_id(ID) | |
+ @@instance = Asset.new(:id => ID, :asset_type => 'Everyone') unless @@instance | |
end | |
- @@instance = Everyone.find_by_id(ID) | |
else | |
@@instance | |
end | |
+ return @@instance | |
end | |
def initialize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment