A little clarification (I hope): if SimpleForm is detected when you run
rails generate devise:views, Devise will automatically generate the SimpleForm version of the Devise views. There is nothing to specify to get the SimpleForm version. (Tested with Devise 1.5.3 and SimpleForm 2.0.1.)
If, like me, you had already generated the Devise views
before installing SimpleForm, you'll need to re-generate the views after installing SimpleForm,
Also, if you just delete the locally-generated Devise views (app/views/devise), even if SimpleForm is installed, Devise will not use SimpleForm-styled views "in the background." You have to generate local Devise views even if you don't want to customize them.
Finally, if you're using Twitter Bootstrap and the Bootstrap extensions to SimpleForm (
rails generate simple_form:install --bootstrap
), when you generate Devise views (
rails generate devise:views), Devise does
not add the Bootstrap styles automatically. If you want horizontal forms, for example, you could add this line to app/config/initializers/simple_form.rb:
config.form_class = 'simple_form form-horizontal'Unfortunately, it seems that can't be overridden at the view level (in case you sometimes want vertical forms). The other option is to manually add the Bootstrap class to each Devise view, e.g. in app/views/devise/sessions/new.html.erb, change this line
<%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>to this:
<%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'form-horizontal' }) do |f| %>Let me know if I misunderstood anything.
Mark Berry