ruby on rails - Constants in Model and View with select option and show view -


I have some models that I use in my model as a constant:

 < Code> class Animal & lt; ActiveweCord :: Base Layz = {: Veerbinner = & gt; 4 ,: Zweibiner = & gt; 2} end  

I use this form for the formattic:

   

How do I format the view so that instead of showing me the number, it shows the key to hash?

In my show view:

  & lt; P & gt; & Lt; Strong & gt; Legs: & lt; / Strong> & Lt;% = h @ animal.legs% & gt; & Lt; / P & gt;  

  animal :: legs .select {| K, v | V == @ animal.legs} .first.first  

Though better make it supportive.


Comments