when i use belongs_to association in rails, the the foreign which is automatically generated or i have to add that column first in the schema and then use association
class ClientQuestionnaire < ActiveRecord::Base
belongs_to :question , :class_name => 'Questionnaire'
end
class Questionnaire < ActiveRecord::Base
has_many :client_questionnaires
end
Do i have to make question_id first in client_questionnaires table and then use belongs_to :question , :class_name => 'Questionnaire' statement in my model
Aucun commentaire:
Enregistrer un commentaire