views:

26

answers:

1

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
+1  A: 

You can access the form's object like:

f.object
dombesz
You are awesome. And you save me sooo much time. Why couldn't I find that in the docs?
Reactor5
That's part of the rails, so should be in the rails docs, i think i found there. http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for
dombesz