Created
December 2, 2009 16:12
-
-
Save kaichen/247315 to your computer and use it in GitHub Desktop.
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
# hack formtastic to add this feature: | |
# let form.inputs method could render the accessible attributes | |
# code in http://github.com/kaichen/formtastic | |
# rails_app_root/app/models/user.rb | |
class User < ActiveRecord::Base | |
... | |
attr_accessible :name, :email, :password, :password_confirmation | |
... | |
end | |
# rails_app_root/app/views/users/_form.html.erb | |
<%= form.inputs %> | |
#=> <fieldset class="inputs"> | |
#=> <ol> | |
#=> <li class="string required" id="user_name_input"> | |
#=> <label for="user_name">Name<abbr title="required">*</abbr></label> | |
#=> <input id="user_name" maxlength="255" name="user[name]" size="50" type="text" /> | |
#=> </li> | |
#=> <li class="password required" id="user_password_confirmation_input"> | |
#=> <label for="user_password_confirmation">Password confirmation<abbr title="required">*</abbr></label> | |
#=> <input id="user_password_confirmation" name="user[password_confirmation]" size="50" type="password" /> | |
#=> </li> | |
#=> <li class="text required" id="user_roles_input"> | |
#=> <label for="user_roles">Roles<abbr title="required">*</abbr></label> | |
#=> <textarea cols="40" id="user_roles" name="user[roles]" rows="20"></textarea> | |
#=> </li> | |
#=> <li class="password required" id="user_password_input"> | |
#=> <label for="user_password">Password<abbr title="required">*</abbr></label> | |
#=> <input id="user_password" name="user[password]" size="50" type="password" /> | |
#=> </li> | |
#=> <li class="string required" id="user_email_input"> | |
#=> <label for="user_email">Email<abbr title="required">*</abbr></label> | |
#=> <input id="user_email" maxlength="255" name="user[email]" size="50" type="text" /> | |
#=> </li> | |
#=> </ol> | |
#=> </fieldset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment