2008
12.31
12.31
Step 1:
- Install the plugin “script/plugin install enum-column”
Step 2:
- Define the table schema. for example
create_table :enumerations, :force => true do |t|
t.column :severity, :enum, :limit => [:low, :medium, :high, :critical],
:default => :medium
t.column :color, :enum, :limit => [:red, :blue, :green, :yellow]
...
end
Step 3:
In the model add validation
validates_columns :severity, :color
Step 4:
In the controller @e = Enumeration.new
Step 5:
In the views <%= input 'e', 'severity' > This will create a select box with all the options
No Comment.
Add Your Comment