Sha256: 67f5f562cbb4b5a8a593aca955f2d8958135aec4d71ef51c95ac503233fce237

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

Formation
=========

`formation` is a ruby library for building, validating, and extending forms.

Simple:

    class RegistrationForm

      include Formation::Form

      fieldset :account do
        field :login_name, :type => :text, :required => true
        field :password, :type => :text, :required => true
      end

      fieldset :address do
        field :address, :type => :text
        field :city, :type => :text
      end

    end

Model:

    class Post

      include DataMapper::Resource

      property :id, Serial
      property :title, String
      property :body, Text
      property :created_at, DateTime

    end

    class PostForm

      include Formation::Form

      resource :post do
        fieldset :legend => 'New Post' do
          field :title, :type => :text, :required => true
          field :body, :type => :textarea, :required => true
        end
      end

      def initialize(post)
        @post = post
      end

    end

### Validating
...

### Printing
...

### Extending
...

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formation-0.0.1 readme.md