Commit 41cdfb9e117924adf99ac5ac43bdf49b9c8f77af
- Date: Fri Feb 29 11:32:01 +0000 2008
- Committer: Xavier Shay (xavier@rhnh.net)
- Author: Gareth Townsend (quamen@Gareth-Townsends-Mac-Pro.local)
- Commit SHA1: 41cdfb9e117924adf99ac5ac43bdf49b9c8f77af
- Tree SHA1: e93f304caa430637e3e6202eb4e0693f44e8925d
added before_create to comments controller to ensure that save is successful when open_id_authentication is not used
Commit diff
| |   |
| 30 | 30 | :code_formatter => Lesstile::CodeRayFormatter |
| 31 | 31 | ) |
| 32 | 32 | end |
| 33 | |
| 34 | # Ensure that comments can be saved when not using open_id validation |
| 35 | def before_create |
| 36 | unless requires_openid_authentication? |
| 37 | self.author_openid_authority = "" |
| 38 | self.author_url = "" |
| 39 | self.author_email = "" |
| 40 | end |
| 41 | end |
| 33 | 42 | |
| 34 | 43 | def requires_openid_authentication? |
| 35 | 44 | !!self.author.index(".") |
| toggle raw diff |
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -30,6 +30,15 @@ class Comment < ActiveRecord::Base
:code_formatter => Lesstile::CodeRayFormatter
)
end
+
+ # Ensure that comments can be saved when not using open_id validation
+ def before_create
+ unless requires_openid_authentication?
+ self.author_openid_authority = ""
+ self.author_url = ""
+ self.author_email = ""
+ end
+ end
def requires_openid_authentication?
!!self.author.index(".") |