Permalink
Browse files

Release 0.6.1

 * updated docs of uniqueness validation, parts taken from ruby sequel
 * require correct version of not-naughty
 * don't add a release when run release task, just add the file
  • Loading branch information...
1 parent ded4337 commit a933028ba0612f63dba3f725999dd98b7a3e15f3 @boof committed Oct 10, 2008
Showing with 12 additions and 3 deletions.
  1. +0 −1 Rakefile
  2. +1 −1 lib/sequel_notnaughty.rb
  3. +11 −1 lib/validations/uniqueness_validation.rb
View
@@ -113,7 +113,6 @@ end
##############################################################################
task :release => [:package] do
sh %{rubyforge login}
- sh %{rubyforge add_release not-naughty not-naughty #{VERS} pkg/#{NAME}-#{VERS}.tgz}
sh %{rubyforge add_file not-naughty not-naughty #{VERS} pkg/#{NAME}-#{VERS}.gem}
end
View
@@ -3,7 +3,7 @@
gem 'sequel', '>= 2.5.0'
require 'sequel'
-#gem 'not-naughty', '0.6.1'
+gem 'not-naughty', '= 0.6.1'
require 'not_naughty'
::NotNaughty::Validation.load(:acceptance, :confirmation, :format, :length, :numericality, :presence)
@@ -1,8 +1,18 @@
module NotNaughty
+
+ # Validates only if the fields in the model (specified by atts) are
+ # unique in the database. You should also add a unique index in the
+ # database, as this suffers from a fairly obvious race condition.
+ #
+ # Possible Options:
+ # <tt>:in</tt>:: scope could be a single or multiple attributes
+ # <tt>:message</tt>:: see NotNaughty::Errors for details
+ # <tt>:if</tt>:: see NotNaughty::Validation::Condition for details
+ # <tt>:unless</tt>:: see NotNaughty::Validation::Condition for details
class UniquenessValidation < Validation
def initialize(valid, attributes) #:nodoc:
- valid[:message] ||= '%s is not unique.'
+ valid[:message] ||= '%s is already taken.'
valid[:in] = case valid[:in]
when Array; valid[:in].map { |scp| scp.to_sym }
when String, String; [ valid[:in].to_sym ]

0 comments on commit a933028

Please sign in to comment.