Permalink
Browse files

more formtastic:form docs

  • Loading branch information...
1 parent 44e944c commit 29e26ca41382b10c4747f91795ab0ea9ab0b412c @justinfrench committed Jan 20, 2011
Showing with 13 additions and 2 deletions.
  1. +11 −2 README.textile
  2. +2 −0 lib/generators/formtastic/form/form_generator.rb
View
@@ -502,7 +502,7 @@ Run @rails generate formtastic:install@ to copy a commented out config file into
h2. Form Generator
-There's a Formtastic form code generator to make your transition to Formtastic easier. All you have to do is to *specify an existing model name*, and optionally specify view template framework (ERB/HAML), and you are good to go. *Note:* This won't overwrite any of your stuff.
+There's a Formtastic form code generator to make your transition to Formtastic easier. All you have to do is to *specify an existing model name*, and optionally specify view template framework (ERB/HAML), and you are good to go. *Note:* This won't overwrite any of your exsting files without confrmation.
h3. Basic usage
@@ -531,11 +531,20 @@ h3. Specifying HAML instead of ERB with @--haml@
h3. Specifying controller namespace with @--controller@
<pre>
- $ rails generate formtastic:form Post --partial --controller admin/posts
+ $ rails generate formtastic:form Post --controller admin/posts
exists app/views/admin/posts
create app/views/admin/posts/_form.html.erb
</pre>
+h3. Specifying which attributes need an input
+
+<pre>
+ $ rails generate formtastic:form Post title:string body:text publication_state:select
+ exists app/views/admin/posts
+ create app/views/admin/posts/_form.html.erb
+</pre>
+
+
h2. Custom Inputs
@@ -11,6 +11,8 @@ module Formtastic
# $ rails generate formtastic:form Post --haml
# @example Generate a form for specific model attributes
# $ rails generate formtastic:form Post title:string body:text
+ # @example Generate a form for a specific controller
+ # $ rails generate formtastic:form Post --controller admin/posts
class FormGenerator < Rails::Generators::NamedBase
desc "Generates a Formtastic form partial based on an existing model."

0 comments on commit 29e26ca

Please sign in to comment.