I created two models:
Answers
AnswersTypes {id, text}
The latter one could accept two values {correct / wrong}
as text.
I modified the admin panel to accept an html select field to link an AnswerType directly within the Answer.
Now the issue is that in the Answer's list page I have a column AnswerType in which i could see the ID of the linked AnswerType but I would like to see the text instead of the ID.
In the file /admin/answers/views/index.erb
the field is:
<td><%= answer.answer_type %=></td>
How could I modify it to select the text starting from that id !?
Thank you very much and ... I have to say that Padrino Rocks!
EDIT: adding some infos
SCHEMA
create_table "answer_types"
t.string "text"
[..]
create_table "answers"
t.string "text"
t.integer "answer_type_id"
[..]
models/answer.rb
class Answer < ActiveRecord::Base
[..]
has_one :answerType
models/answer_types.rb
class AnswerTypes < ActiveRecord::Base [..] belongs_to :answer