Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Iain Hecker
committed
Nov 4, 2008
1 parent
7f89625
commit 72b07e0
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,31 @@ | ||
h1. ModelBasedHtml | ||
|
||
This plugin enables the binding of other html elements to models, just like form_for. | ||
|
||
An example says it all: | ||
|
||
<% definition_list_for @user do |dl| %> | ||
|
||
<%= dl.dt :login %> | ||
<%= dl.dd :login %> | ||
|
||
<%= dl.dt :email %> | ||
<%= dl.dd :email do |mail_address| %> | ||
<%= mail_to mail_address %> | ||
<% end %> | ||
|
||
<% end %> | ||
|
||
The dt method will automatically display the human_attribute_name of this | ||
attribute, the dd will automatically show the value of this attribute. You can | ||
pass a block to these methods to play with the value even more, like making it | ||
a link. Because these values may be harmful, a dd_h method is also available, | ||
sanitizing html automatically. You can limit it to one line, using dt_and_dd or dt_and_dd_h. | ||
|
||
A table_for is also under development. | ||
|
||
Please note that this plugin is still very much under development. Use at your own risk. | ||
|
||
|
||
|
||
Copyright (c) 2008 Iain Hecker, released under the MIT license |