Plugins - Validation Group

StarAdd to favorites

Using the plugin, you can define validationgroups on the model level, defining which fields you would like to validate. When you create an instance of model, you can set the desired validationgroup to use. This is useful for wizard type forms where you want to do validation as you step along the forms, instead of having to do it at the end.

Here is an example:

class User < ActiveRecord::Base

validates _ presence_of :name, :description, :address, :email

validation _ group :step1, :fields=>[:name, :description]

validation _ group :step2, :fields=>[:address]

end

Here is how you enable the validation group

@user = User.new
@user.enable_validation_group :step1
@user.valid?

Alex Kira

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

http://validationgroup.rubyforge.org/svn/tags/validationgroup

Rails' (MIT)

  • Currently 4.3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Model

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?