简体   繁体   中英

Accessing object of form in formtastic

So I'm making a survey app. The users choose a type of form on the backend, and it displays as a certain type on the front end. That's only ideally, of course. What happens now is I can't access the object formtastic is building the form for. How can I say something like "question.kind"? It just makes an error that way. Here's what I have so far...

= semantic_form_for @survey, :url => "#", :html => { :method => "get" } do |f|
  - for question in @survey.questions
    = user_facing_question(f)

and the complementary helper method goes like this so far:

def user_facing_question(f)
  f.inputs
end

您可以访问表单的对象,如:

f.object

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM