Skip to content

Instantly share code, notes, and snippets.

@jasondew
Created July 12, 2010 22:05
Show Gist options
  • Save jasondew/473149 to your computer and use it in GitHub Desktop.
Save jasondew/473149 to your computer and use it in GitHub Desktop.
class MyControllerOrPlainRubyObject
extend CodedOptions
coded_options :state, %w(initial active closed)
STATES = %w(initial active closed)
STATE_OPTIONS = [["initial", 0],
["active", 1],
["closed", 2]]
def state
return unless state_id
STATES[state_id]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment