Skip to content

Instantly share code, notes, and snippets.

@ohammersmith
Created May 5, 2009 16:02
Show Gist options
  • Save ohammersmith/107022 to your computer and use it in GitHub Desktop.
Save ohammersmith/107022 to your computer and use it in GitHub Desktop.
class FoosController
def new
@foo = Foo.new
@foo.attribute = "asdf"
@foo.bars.build(:name => "blah")
@default_questions = {}
@default_questions[:multipe_choice] = Question.new(....)
end
end
form_for @foo |f|
....
f.fields_for questions, :index => "" do |ff|
....
#name=foo[][bar]
# name=foo[questions][]...
ff.fields_for @default_qeustions[:multiple_choice]
....
end
....
end
class Foo
has_many :bars
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment