Agile Web Development

Build it. Launch it. Love it.

Smart form

SmartForm

===

The form helper with intelligence!

Creates nicely laid out form fields for an ActiveRecord object, including it’s content columns and association reflections. The form fields are encapsulated in an HTML definition list.

Author: Michael Behan aka "Jabberwock" (jabberwock /AT tenebrous /DOT com; or Jabberwock on irc.freenode.net) Copyright: Copyright© 2007 Michael Behan, released under the BSD license For an example style-sheet via:

  ruby script/generate SmartFormStyles

Usage:

  smart_form_for(symbol, options)

Examples:

  <% form_for people_url, :method => :post do %>
    <%= smart_form_for :person %>
  <% end %>

  <% form_for edit_person_url(@person) do %>
    <%= smart_form_for :person, :object => @person %>
  <% end %>

For full documentation, including options, please visit vendor/plugins/smart_form/rdoc/index.html

Please feel free to e-mail me with feedback!

Enjoy :)

Michael Behan

Vitals

Home http://www.behanisms.com/
Repository git://github.com/jabberwock/smart_form.git
License BSD
Tags Tag_red actionview associations bitchin easy fds fields forms habtm jabberwock reflections scaffold smart useful
Rating (29 votes)
Owner Jabberwock
Created 25 April 2007

Comments

  • Avatar
    carlos k
    25 April 2007

    Please post a link with examples of how the smart forms look.

  • Avatar
    Jabberwock
    26 April 2007

    I will have this up soon :) Thanks!

  • Avatar
    26 April 2007

    I second the request for a live demo or screenshots. Would be most helpful.

  • george
    27 April 2007

    Hey looks like it does not work with postgres database. generates this error: "126: The specified module could not be found. - c:/ruby/lib/ruby/gems/1.8/gems/ruby-postgres-0.7.1.2006.04.06-mswin32/./postgres.so" despite having the latest build for that gem. Otherwise it worked fine with mysql database.

  • Avatar
    Jabberwock
    27 April 2007

    This appears to be an issue with your postgres gem installation. SmartForm extends ActiveRecord and doesn't actually reference the database adapter directly. Have you tried the ruby-pr gem?

  • Avatar
    Jabberwock
    27 April 2007

    As promised, here is a simple demo:

    http://admin.beta.ddna.org/smart_form_demo

  • 28 April 2007

    How is order of items in the form determined?

  • Avatar
    Jabbberwock
    30 April 2007

    By default, the display order is as it appears in the database (ie DESCRIBE TABLE or \d table. I have added an :order option which takes an array of column/reflections for display order. Please svn up!

  • Torso
    9 May 2007

    Where are the labels coming from?

  • Avatar
    Jabberwock
    9 May 2007

    They're based on the column or reflection names.

  • Henrique
    2 December 2007

    Demo not working, I can't see how the form looks like.

  • Henrique
    8 January 2008

    Can't get from Repository

  • OA
    27 February 2008

    Repository still unavailable.

  • m
    3 April 2008

    svn is not working, the site bleedingtrends.com is actually parked!

  • mickey
    25 July 2009

    there's so much unreliable and dead plugins lately...

Add a comment