Plugins - valid_attributes

StarAdd to favorites

Installation

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

Kei Kusakari

http://code.google.com/p/valid-attributes/

http://valid-attributes.googlecode.com/svn/

Rails' (MIT)

  • Currently 4.0/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?