0
我有question_options有很多關係的問題模型。有條件簽到rabl
class Question < ActiveRecord::Base
#relationship
belongs_to :user
has_many :question_options, :dependent => :destroy,:conditions => "is_deactivated is FALSE"
問題選項
class QuestionOption < ActiveRecord::Base
attr_accessible :question_id,:option,:order,:is_other,:is_deactivated
belongs_to :question
在我question_detail Rabl的我有
object @question
attributes :id, :status
child :question_options do
attributes :question_id,:option,:order,:is_other
end
在這裏,我想只響應其中有is_other =假
like the below....
object @question
attributes :id, :status
child :question_options do
attributes :question_id,:option,:order,:is_other = true
end
如何question_option d o我檢查一個條件是什麼?
您是否試圖限制Question或QuestionOptions的渲染? – phillbaker
是@phillbaker我想限制一個條件questionoption。我需要獲取在is_other字段中有效的問題選項 – ferdy