Skip to content

elandesign/formtastic_enum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FormtasticEnum

An extension for Formtastic1 to generate select inputs for belongs_to_enum2 fields.

Example

In the model class:

class Task < ActiveRecord::Base
  belongs_to_enum :status, { 1 => :new, 2 => :in_progress, 3 => :completed, 4 => :cancelled }
end

And in the view

<% semantic_form_for @task do |form| %>
  <% form.inputs do %>
    <%= form.input :status, :as => :enum %>
  <% end %>
<% end %>

Dependencies

You must have the formtastic gem/plugin and the belongs_to_enum plugin added to your application.

Todo

Test, test, test…

References

1 Formtastic @ GitHub

2 BelongsToEnum @ Github

Copyright © 2009 Paul Smith, released under the MIT license

About

An input plugin for formtastic to render belongs_to_enum fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages