module Lolita::Configuration::Field
Lolita::Configuration::Field
is class that allow to configure fields. To change behaviour of field you can use these attributes
-
name
- field name, used to set or get value from related ORM object -
type
- can change the way field is shown and how data is formated -
on
- when to show field on hide, accepts array or symbol. Possible states are :create, :update or proc -
field_set
- define field set that field belongs to. SeeLolita::Configuration::FieldSet
-
nested_in
- define field for differentLolita::DBI
instance, than given. This is used to create nested fields in one form for related models. Like user and profile, where in user form there are fields from profile that can be manipulated when user is changed or created. -
options
- specific options for different type of fields, see Lolita::Configuration::FieldExtensions for details -
html_options
- used to change field HTML output,like class or style etc.
To define field in ORM class through lolita configuration block
Example¶ ↑
lolita do tab do field :email field :user_id, :type=>"string" field :body do title "Full text" html_options :class=>"full_text" end end end