RailsCasts Pro episodes are now free!
Learn more or hide this
Resources
rails generate devise_views rails generate migration add_username_to_users username:string rake db:migrate rails c
before_filter :authenticate_user!, :except => [:show, :index]
devise_for :users, :path_names => { :sign_up => "register" }
config.authentication_keys = [ :username ] config.password_length = 4..20
<% title "Sign in" %> <%= form_for(resource_name, resource, :url => session_path(resource_name)) do |f| %> <p><%= f.label :username %><br /> <%= f.text_field :username %></p> <p><%= f.label :password %><br /> <%= f.password_field :password %></p> <!-- ... --> <% end %>