· 1 min read

Screencast: Devise anpassen

Download:

Download (21.6 MB, 7:52) Alternativer Download für iPod & Apple TV (16.9 MB, 7:52)

Resourcen:

Quellcode:

[bash] rails generate devise_views rails generate migration add_username_to_users username:string rake db:migrate rails c [/bash]

[ruby] # projects_controller.rb before_filter :authenticate_user!, :except => [:show, :index]

# routes.rb devise_for :users, :path_names => { :sign_up => “register” }

# config/initializers/devise.rb config.authentication_keys = [ :username ] config.password_length = 4..20 [/ruby]

[html] <% title “Sign in” %>

<%= form_for(resource_name, resource, :url => session_path(resource_name)) do |f| %>

<%= f.label :username %>
<%= f.text_field :username %>

<%= f.label :password %>
<%= f.password\_field :password %>

<% end %> \[/html\]
Back to Blog