Project

warnr

0.0
No commit activity in last 3 years
No release in over 3 years
Ernr 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.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project 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