I have a View called View_CrossReference
in Sybase. I want to create Model for this view. This table has a column called Answer
.
I have an another table and model called SurveyXref
. In this table i have a column called Answer_No
.
I want to create a relationship between these models and get the data from Answer
column from View_CrossReference
and display into my grid in SurveyXref
page.
IN view_crossreference model
has_one :survey_xrefs, :primary_key => :answer, :foreign_key => :answer_no
In survey_xrefs model
belongs_to :view_crossreference, :primary_key => :answer , :foreign_key => :answer_no
now simply in controller u can access
v.view_crossreference.answer
Without "Model", means you have created table via stand alone migration. Could you please show me your code for better understanding?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.