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. I am creating form for the Answer model. Example: <%= 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. Thanks
on 2012-10-11 01:49
on 2012-10-11 09:50
On 10 October 2012 23:54, Sri ganesh K <srickganesh@gmail.com> wrote: > 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 requirements. > 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. Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.