Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mentioned to_label in the README

  • Loading branch information...
commit 0c71a46890c25082a3234652aad21cc77dcf8adc 1 parent d53508c
Justin French authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 README.textile
18 README.textile
@@ -115,7 +115,23 @@ With an output something like:
+h2. Conventions & Prerequisites
+In a few places (like radio or select widgets for belongs_to associations) Formtastic expects your ActiveRecord instances to respond to the <code>to_label</code> method (returning a String). You can easily add this to your models, for example, a User object might want to return the user's first name, last name and login:
+class User < ActiveRecord::Base
+ #...
+ def to_label
+ "#{first_name} #{last_name} (#{login})"
+ end
h2. What about Stylesheets?
The plan is that a CSS file similar to this will be generated or otherwise made available to your app to give you basic vertical (labels above inputs) and horizontal (labels to the left of inputs), and then if needed, you would write new styles on top to customise the presentation to suit you.
Please sign in to comment.
Something went wrong with that request. Please try again.