Skip to content

Instantly share code, notes, and snippets.

@blairanderson
Last active February 22, 2017 06:44
Show Gist options
  • Save blairanderson/54456e46c02b6128902b to your computer and use it in GitHub Desktop.
Save blairanderson/54456e46c02b6128902b to your computer and use it in GitHub Desktop.
Simple_enum Simple_form

This was helpful.

meal.rb

class Meal < ActiveRecord::Base
  as_enum :type, [:breakfast, :brunch, :lunch, :dinner]

end

meals/_form.haml

= simple_form_for @meal do |f|
  = f.input :type, collection: enum_option_pairs(Meal, :type)
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment