Skip to content
This repository

render fields_for once #129

Closed
tbohr opened this Issue · 3 comments

4 participants

Torben Bohr Henrikas Elsbergas David Southard Sergey Nartimov
Torben Bohr

Hello,

can you give me a hint how i render "fields_for" subform once if model is empty?
A user has to click once before he can fill the form....

Is it better with jQuery or ruby?

Thanks!!!!!!!!

Henrikas Elsbergas

In your controller add
def new
@record = Record.new
1.time { @record.plural_association_name.build }
end

David Southard

not trolling but I think this supposed to be 1.times not 1.time at least in Ruby 1.9.3-p125.

Sergey Nartimov
Collaborator
lest commented

@tbohr You can build records in the controller like @netyciukas suggested.

Sergey Nartimov lest closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.