-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twitter_bootstrap_fields_for not working #38
Comments
I discovered the issue. The signature of the fields_for method is def fields_for(record_name, record_object = nil, options = {}, &block) But the call in form_helpers.rb is send method, record, *(args << options), &block So, the options hash, which contains the :builder key that defines the builder, is sent as the second parameter, not the third. And this is why the builder does not change. |
The define_method "twitter_bootstrap_#{method}" do |record, *args, &block| The call works as expected: the record is passed as the first parameter, and the |
<%= twitter_bootstrap_fields_for @user do |user_form| %>
<%= user_form.inputs 'Sign Up', :class => 'sign_up' do %> And the error is
Also <%= twitter_bootstrap_fields_for @user, nil do |user_form| %>
<%= user_form.inputs 'Sign Up', :class => 'sign_up' do %> works fine. So, if the second argument is omitted, the options argument is sent as the second argument, and it is not recognized. I think that before calling the send method, it should be checked if the method is field_for, and the number of arguments is 0, and in this case a nil argument should be added |
When trying to do twitter_bootstrap_fields_for, and then call new_form.inputs, this error is shown "undefined method `inputs' for #<ActionView::Helpers::FormBuilder"
The text was updated successfully, but these errors were encountered: