ruby on rails - Devise and helper for custom form builder -
i created custom form builder devise sign form.
form looks this, , works fine:
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), builder: bootstrapformbuilder) |f| <%= f.text_field :username, :autofocus => true %> <%= f.email_field :email %> <%= f.password_field :password %> <%= f.password_field :password_confirmation %> <%= f.submit "sign up", class: "btn btn-default" %> <% end %> now want create helper named bootstrap_form_for. in application helper wrote (just test it):
module applicationhelper def bootstrap_form_for(record, options = {}, &block) form_for(record, options = {}, &block) end end when instead of form_for insert bootstrap_form_for error: undefined method 'users_path' #<#<class:0x007f9eb40bc728>:0x007f9eb40bb9b8> in bootstrap_form_for line.
error page title: nomethoderror in devise::registrations#new
do know why?
problem here:
module applicationhelper def bootstrap_form_for(record, options = {}, &block) form_for(record, options = {}, &block) end end it should be:
module applicationhelper def bootstrap_form_for(record, options = {}, &block) form_for(record, options, &block) end end
Comments
Post a Comment