ruby on rails - RoR 3 - overriding the FormBuilder default f.submit into a button -


i have form, , layout (and future use), know how change default f.submit generates a:

to html tag shouldn't give errors.

what have extention on formbuilder

in view:

   <%= form_for resource, :as => resource_name, :url => session_path(resource_name),  :class => "form with-margin", :builder => appformbuilder |f| %>    ...    <%= f.submit %>    <% end %> 

in lib/appformbuilder:

class appformbuilder < actionview::helpers::formbuilder   def submit(text, options = {})     options[:type] = "submit"     @template.content_tag(:button, text, options)   end end 

but gives me error:

nameerror in devise/sessions#new  showing d:/projects/websites/ruby on rails/fact-it/app/views/devise/sessions/new.html.erb line #11 raised: uninitialized constant actionview::compiledtemplates::appformbuilder   8:          9:       <p class="message error no-margin alert"><%= alert %></p> 10:       <p class="notice"><%= notice %></p> 11:       <%= form_for resource, :as => resource_name, :url => session_path(resource_name), :class => "form with-margin", :builder => appformbuilder |f| %> 12:         <p><%= f.label :email %><br /> 13:         <%= f.text_field :email %></p> 14:  

you need put variable in lib/app_form_builder.rb if want use rails autoloading.

warning, in rails 3 default autoloading doesn't exist anymore. need add autoload directory in application.rb


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -