0
question_options의 관계가 많은 질문 모델이 있습니다.rabl의 조건부 체크
class Question < ActiveRecord::Base
#relationship
belongs_to :user
has_many :question_options, :dependent => :destroy,:conditions => "is_deactivated is FALSE"
질문 옵션 난 = 거짓
like the below....
object @question
attributes :id, :status
child :question_options do
attributes :question_id,:option,:order,:is_other = true
end
어떻게 is_other이 단지 question_option 응답하려면 여기
object @question
attributes :id, :status
child :question_options do
attributes :question_id,:option,:order,:is_other
end
을 내 question_detail의 rabl에서
class QuestionOption < ActiveRecord::Base
attr_accessible :question_id,:option,:order,:is_other,:is_deactivated
belongs_to :question
디 o 나는 조종석에서 상태를 확인합니까? 이 작업을 수행하는
질문 또는 QuestionOptions의 렌더링을 제한하려고합니까? – phillbaker
예 @phillbaker 나는 질문으로 조건을 제한하고 싶다. 나는 is_other 필드에있는 질문 옵션을 가져와야합니다. – ferdy