Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ma committed Dec 26, 2012
1 parent 5c45736 commit ac16e4d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
11 changes: 11 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
module ApplicationHelper
def resource_name
:user
end

def resource
@resource ||= User.new
end

def devise_mapping
@devise_mapping ||= Devise.mappings[:user]
end
end
11 changes: 5 additions & 6 deletions app/views/home/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
h1 = t('slogan.title')
p = t('slogan.description')
.span5.offset2
form.login
label = t('label.nickname')
form.login action="/users" accept-charset="UTF-8" id="new_user" method="post"
= devise_error_messages!
input type="text" placeholder=t('label.nickname')
label = t('label.email_address')
input type="text" placeholder=t('label.email_address')
label = t('label.password')
input type="password" placeholder=t('label.password')
input#user_email name="user[email]" size="30" type="email" placeholder=t('label.email_address')
input#user_password name="user[password]" size="30" type="password" placeholder=t('label.password')
input#user_password name="user[password_confirmation]" size="30" type="password" placeholder=t('label.password')

button.btn type="submit" = t('label.sign_up')

Expand Down
20 changes: 19 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 0) do
ActiveRecord::Schema.define(:version => 20121226132049) do

create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true

end

1 comment on commit ac16e4d

@guxiaobai
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application_helper.rb 里增加了下面三个方法

  • resource_name
  • resource
  • devise_mapping

不知道具体起到什么作用

Please sign in to comment.