Constants in Model and View with select option and show view
- by caplod
i have a some values ,that i use in my model as constants.
class Animal < ActiveRecord::Base
LEGS = {:vierbeiner => 4, :zweibeiner => 2 }
end
in the form (formtastic) for the collection i use:
<%= f.input :legs, :as => :select, :collection => Animal::LEGS =>
but how do i format the show view so instead showing me the number , the key of the hash?
in show view i have:
<p>
<strong>Legs:</strong>
<%=h @animal.legs %>
</p>