GithubHelp home page GithubHelp logo

jeffp / validationgroup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akira/validationgroup

3.0 3.0 1.0 88 KB

Plugin to add conditional validation to Rails based on validation groups that can be enabled / disabled

Home Page: http://alexkira.blogspot.com/2007/09/rails-validation-using-validation.html

License: MIT License

Ruby 100.00%

validationgroup's Introduction

ValidationGroup
===============

When doing multipage forms that spread a models fields over several pages, validation becomes more difficult.  We would like to validate each step of the form, however, the rails validation run validation on all the fields.  This plugin enables you to define validation groups with certain fields, and then only run validation on those groups.

To install, type: git clone git://github.com/akira/validationgroup.git vendor/plugins/validationgroup && rm -rf vendor/plugins/validationgroup/.git

Home page for plugin is: http://alexkira.blogspot.com/2007/09/rails-validation-using-validation.html

Example
=======

class User < ActiveRecord::Base
  validates_presence_of :name, :description, :address, :email
  
  validation_group :step1, :fields=>[:name, :description]
  validation_group :step2, :fields=>[:address]     
end

This will run validation on :step1 fields
@user = User.new
@user.enable_validation_group :step1
@user.valid?

You can later disable validation groups by calling:
@user.disable_validation_group


Copyright (c) 2007 Alex Kira, released under the MIT license

validationgroup's People

Contributors

jeffp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

syncrou

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.