Non-fatal rails 3 validations (ie, warnings rather than errors)
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
rdoc
spec
.gitignore
MIT-LICENSE
README
Rakefile
VERSION
init.rb
install.rb
uninstall.rb
warnr.gemspec

README

Warnr
======

Warnr builds on the power of Rails 3 validations.
It lets you use validations to identify situations which are warnings rather than errors.
It also lets you define a callback on the model which is executed after save if there are any warnings.

Usage Example

class Client < ActiveRecord::Base
  # Notify the client manager that the ABN has not been set
  belongs_to :manager, :class_name => "User"
  
  validates_presence_of :abn, :manager_id
  
  treat_validation_errors_as_warnings_on :abn
  on_save_with_warnings :handle_warnings
  
  def handle_warnings
    MissingDataNotifier.missing_data_notification(client.manager, client).deliver
    # Will save the record in a week, which will trigger this process again.
    DelayedJob.create(1.week, Client, client.id, :save)
  end
end


Copyright (c) 2010 Daniel Heath, released under the MIT license