Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

nuked the configuration copy/paste from the README, linked to the gen…

…erator source instead
  • Loading branch information...
commit 71ef99fd4317d90bdf87b477aade7cd24befb44e 1 parent 2bf5b23
@justinfrench authored
Showing with 4 additions and 52 deletions.
  1. +4 −52 README.textile
56 README.textile
@@ -259,6 +259,7 @@ h2. Internationalization (I18n)
Formtastic got some neat I18n-features. ActiveRecord object names and attributes are, by default, taken from calling @object.human_name and @object.human_attribute_name(attr) respectively. There are a few words specific to Formtastic that can be translated. See lib/locale/en.yml for more information.
h3. Label/Hint-localization
Formtastic supports localized *labels* and *hints* using the I18n API for more advanced usage. Your forms can now be DRYer and more flexible than ever, and still fully localized. This is how:
@@ -396,65 +397,16 @@ For more flexible forms; Formtastic find translations using a bottom-up approach
*Note:* For @title@: ATTRIBUTE is a KEY chosen by you, e.g. in step 4 example above: @:post_details@.
h2. ValidationReflection plugin
If you have the "ValidationReflection": plugin installed, you won't have to specify the :required option (it checks the validations on the model instead).
-h2. Configuration
-If you wish, put something like this in config/initializers/formtastic_config.rb:
+h2. Configuration
- # Set the default text field size when input is a string. Default is 50
- Formtastic::SemanticFormBuilder.default_text_field_size = 30
+Run @./script/generate formtastic@ to copy a commented out config file into @config/initializers/formtastic.rb@. You can "view the configuration file on GitHub":
- # Should all fields be considered "required" by default
- # Defaults to true, see ValidationReflection notes below
- Formtastic::SemanticFormBuilder.all_fields_required_by_default = false
- # Set the string that will be appended to the labels/fieldsets which are required
- # It accepts string or procs and the default is a localized version of
- # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
- # in your locale, it will replace the abbr title properly. But if you don't want to use
- # abbr tag, you can simply give a string as below
- Formtastic::SemanticFormBuilder.required_string = "(required)"
- # Set the string that will be appended to the labels/fieldsets which are optional
- # Defaults to an empty string ("") and also accepts procs (see required_string above)
- Formtastic::SemanticFormBuilder.optional_string = "(optional)"
- # Set the way inline errors will be displayed.
- # Defaults to :sentence, valid options are :sentence, :list and :none
- Formtastic::SemanticFormBuilder.inline_errors = :list
- # Set the method to call on label text to transform or format it for human-friendly
- # reading when formtastic is user without object. Defaults to :humanize.
- Formtastic::SemanticFormBuilder.label_str_method = :titleize
- # Set the array of methods to try calling on parent objects in :select and :radio inputs
- # for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
- # that is found on the object will be used.
- # Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
- Formtastic::SemanticFormBuilder.collection_label_methods = ["title_and_author", "display_name", "login", "to_s"]
- # Formtastic by default renders inside li tags the input, hints and then
- # errors messages. Sometimes you want the hints to be rendered first than
- # the input, in the following order: hints, input and errors. You can
- # customize it doing just as below:
- Formtastic::SemanticFormBuilder.inline_order = [:hints, :input, :errors]
- # Set the default "priority countries" to suit your user base when using :as => :country
- Formtastic::SemanticFormBuilder.priority_countries = ["Australia", "New Zealand"]
- # Specifies if labels/hints for input fields automatically be looked up using I18n.
- # Default value: false. Overridden for specific fields by setting value to true,
- # i.e. :label => true, or :hint => true (or opposite depending on initialized value)
- # Formtastic::SemanticFormBuilder.i18n_lookups_by_default = false
- # If you want to subclass SemanticFormBuilder to add/change the behavior to suit your needs, you
- # can specify the builder class.
- # Formtastic::SemanticFormHelper.builder = MyCustomBuilder
h2. Status
Please sign in to comment.
Something went wrong with that request. Please try again.