x無法存取,你可能沒有權限或未登入。
218350ff02e2dd2393c2cb3f0a1c91d2

想請問有沒有人用過surveyor這個gem的

2011-12-27 18:15:45 +0800jiingrubyGem 節點 中發起
最後由 jiingruby2011-12-27 18:32:22 +0800回應 , 232次閱讀

小弟在rails 3.1.0 安裝成功,運作也ok
不過不知道怎麼樣撰寫DSL,使得一定要填寫問卷選項其中之一才能到下一個section
不知各位先進有沒有經驗

也就是希望以下的DSL寫法能work。
由於還不太熟悉如何追別人的gem 的source code,故有此一問。


survey "Favorites" do
  section "Foods" do
    # In a quiz, both the questions and the answers need to have reference identifiers
    # Here, the question has reference_identifier: "1", and the answers: "oint", "tweet", and "moo"
    q_1 "What is the best meat?", :pick => :one, :correct => "oink"
    a_oink "bacon"
    a_tweet "chicken"
    a_moo "beef"
    validation :rule => "D"
    condition_D "!=", nil
  end
end


validation :rule => "D" 
 condition_D "count>", :integer_value => 0

 validation :rule => "D or E or F"
    condition_D "==", :a_oink
    condition_E "==", :a_tweet
    condition_F "==", :a_moo

截至 2011-12-27 18:32:22 +0800,共收到 2 條回應
218350ff02e2dd2393c2cb3f0a1c91d2
jiingruby 1樓, 於2011-12-27 18:16:31 +0800回應
218350ff02e2dd2393c2cb3f0a1c91d2
jiingruby 2樓, 於2011-12-27 18:32:22 +0800回應

看 wiki 裡的
http://github.com/NUBIC/surveyor/wiki/What-surveyor-does%2C-and-doesn%27t-do

Doesn't do
Enforce mandatory questions (although it does have methods on ResponseSet to support that)

好像指的就是這回事......

需要 登入 後方可回應,如果你還沒有帳號按這裡 註冊