Valid Attributes plugin

Plugin details

This plugin provides the ActiveRecord validations with individual attribute.

Websitehttp://code.google.com/p/valid-attributes/ Repositoryhttp://valid-attributes.googlecode.com/svn/tags/valid_attributes Author Kei Kusakari Tags validation, model LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://valid-attributes.googlecode.com/svn/tags/valid_attributes

Usage:

  @foo= Foo.new
  if @foo.valid_attributes?(:attr1)
  end

  if @foo.valid_attributes?(:only => [:attr1, :attr2])
  end

  if @foo.valid_attributes?(:except => [:attr3, :attr4])
  end

  if @foo.save_with_valid_attributes(:only => [:attr1, :attr2])
  end

  if @foo.save_with_valid_attributes(:except => [:attr3, :attr4])
  end

  begin
    @foo.save_with_valid_attributes!(:only => [:attr1, :attr2])
  rescue ActiveRecord::RecordInvalid => e
    # validation error
  end

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (7 older versions) | Last edited by: scott, 3 months ago