lundi 16 mai 2016

Rails Eval method

hi i am using eval to evaluate a string in my controller: something like

   eval(@application.results)

and i get result like:

  {:q1=>false,
  :q2=>false,
  :q3=>false,
  :q4=>true,
  :q5=>false,
  :q6=>false,
  :q7=>false,
  :q8=>false,
  :q10=>false,
  :q11=>true,
  :q12=>false,
  :q13=>false,
  :q14=>false,
  :q15=>false,
  :q16=>true,
  :q17=>false}

having some complications in using eval and i dont want to use it! what will be the best method to replace eval ? or how can i get the sama data structure by not using eval Thanks!

Aucun commentaire:

Enregistrer un commentaire