This repository has been archived by the owner. It is now read-only.
A rails plugin for model objects that support validations but are not backed by database tables
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.


active-form plugin for Rails

active-form is a plugin that makes it easy to have model objects that support the ActiveRecord Validations but are not backed by database tables. The plugin is designed to make it possible to use the ActiveForm derived classes in a very similar manner to the ActiveRecord::Base derived objects.

Originally described at;

How To Define An ActiveForm Object

class Search < ActiveForm

attr_accessor :text
validates_length_of :text, :maximum=>30


How To Use ActiveForm Object In Controller

class NavigatorController < ApplicationController

def search
  @search =[:search])
  if @search.valid? search here...


How To Use ActiveForm Object In View

<%= start_form_tag(:action => 'search') %> <%= error_messages_for('search') %> <%= text_field('search', 'text', {“maxlength” => 30}) %> <button type=“submit”>Save</button> <%= end_form_tag %>


License: Released under the MIT license.


Peter Donald <peter at realityforge dot org>. Dae San Hwang for fix to work with Rails 1.1. Trevor Squires for suggestion to use Reloadable::Subclasses rather than dispatcher hack for Rails 1.1. Tim Lucas for patch to allow bulk addition of attributes. Geoff Schmidt for adding support for Callbacks. Sean Christman for attributes getter. Jack Christensen for attributes setter. Troy Anderson for fixing human_attribute_name for localizations.