Project

mikado

0.0
No commit activity in last 3 years
No release in over 3 years
Wrap validation conditions with a single command
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme
Mikado wraps Activerecord validation conditions with a block.

Mikado has been tested with ruby 1.8/1.9 and ActiveRecord >= 2.3.5

Example:

Instead of

  class Item < ActiveRecord::Base
    validates_presence_of :title, :if => :live?
  
    def live?
      true
    end  
  end

you can write like this

  class Item < ActiveRecord::Base
    include Mikado
    
    mikado :live? do
      validates_presence_of :title
    end
    
    def live?
      true
    end
  end
  
Currently mikado only supports the :if condition.
You can help yourself, just negate the condition value.

It supports all validations with name validates_*
It also supports the methods validate, validate_on_create,
validate_on_update and validate_each