How to get the value of association column name in ruby on rails?

If i have two models like Question and Answer. Question has three columns
like question_id, question_type, question_text and Answer has three values
answer_id, question_id, answer_text.

Question should generally not have a question_id field, it should just
have the default id field. Unless that is you have some unusual

I am creating form for the Answer model.


<%= f.text_field :question_id %>.
<%= f.hidden_field :question_id %>.

Here, I am using the hidden field to find the question_type. I tried the map
method, but that doesn't work. So Somebody help me to get the question_type
value by the selection of thatquestion_id.

You have not shown us the relationship between the models (has_many,
belongs_to or whatever). That information is critical to answering
the question.