Last active
August 29, 2015 14:15
-
-
Save johnnaegle/baf9132c6f7f510bd2b3 to your computer and use it in GitHub Desktop.
rails enums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Issue < ActiveRecord::Base | |
enum :status => {:open => 1, :closed => 2, :reopened => 3, :inprogress => 4} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= form_for @issue do |form| | |
- options = Issue.statuses.map { |k,v| [k.to_s.titleize, k]} | |
= form.select :status, options_for_select(options, @issue.status), {:include_blank => true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment