左手 posted @ 2013年12月12日 20:28 in 积累点滴 with tags devise devise添加用户名 devise添加管理员 rails devise , 4401 阅读


1. 安装devise
# 编辑Gemfile加入以下内容
gem 'devise'
bundle install
rails g devise:install
rails g devise user
rails g devise:views
# 创建数据库
rake db:migrate

2. 使用
# 创建一个空的controller
rails g controller home index --no-helper --no-assets
# 编辑config/routes.rb将home index设为首页
root 'home#index'
# 编辑app/views/home/index.html.erb加入以下内容

<% if user_signed_in? %>
  hello, <%= current_user.username %><br />
  <%= link_to('登出', destroy_user_session_path, :method => :delete) %>
<% else %>
  <%= link_to('注册', new_registration_path(:user)) %>
  <%= link_to('登录', new_session_path(:user)) %>
<% end %>

1. 添加用户名登录 How To: Allow users to sign in using their username or email address
2. 添加管理员角色 How To: Add an Admin Role

maid services dubai 说:
2019年9月17日 21:54

Earlier than jumping into the house maintenance services company’s guidance, let my family suggest that you a fun option to exercise and put some money aside all at once! A investigation indicated that your particular regular unique could lose 200 that will 260 calories per hour doing house cleaning! So, let’s start the main tip meant for saving by just doing most of the houses maintenance alone, and lose some calories as the reward!

I sell pittsburgh ho 说:
2019年11月14日 02:49

It consultants use business clients to enhance the it department within an organization. Consultants aid companies within the implementation associated with new technology within the organization.

pr home school 说:
2020年3月21日 22:03

Begin by thinking about your. Are you in a position to buy a residence? How much on earth do you afford at a monthly loan payment? How a good deal space do you really want? What patches of town you like? When you have answer a lot of these questions, get a "To Do" list as well as begin doing simple research around property. Talk to good friends, drive because of neighborhoods, and check out in that "Homes" element of the journal, Foreclosure Listing, and search.

mv home inspections 说:
2020年3月21日 22:04

Your home inspection, mainly because defined, is definitely examination within the physical system and systems associated with a home, which is designed with a detailed 'snapshot' of the healthiness of the home when the test. The reasons like a your home inspection is in reducing some within the risk needed for purchasing your home; however, it all cannot reduce those problems, nor will the inspector prepare for future gatherings or shifts in performance as a consequence of changes active or occupancy.

uk cleaning director 说:
2020年3月21日 22:04

Almost everyone can like the comfort to a clean and even well preserved home. Home cleaning is known as a necessity several people want to keep their property cleans because of their chaotic schedules. Homes should really be cleaned regularly that allows unpleasant odours and vermin infestations to remain prevented.

part time maids in d 说:
2020年4月29日 18:01

After this you prepare a summary of your anticipation on what you need her to complete. You should ask ahead of time about the actual rates with regard to various work or cleansing services as well as whether you'll need any proprietor insurance. Find out do you know the tax significance if you will hire the independent cleaning service on agreement basis.

painting services in 说:
2020年4月29日 18:01

Mentionened above previously, you might have a expert house plumber paint your home or you might get the job done yourself. Should you intend on doing the work yourself, then you will surely low cost, which might otherwise double for having to pay contractors and also the labor carried out. Since you're working on your personal, there tend to be some required fundamentals that you ought to be acquainted with, when it involves painting the inside of your house.

dial a maid dubai 说:
2021年6月07日 14:27

Without having a proper house cleaning plan, it takes all his time to cover the total house. Not to mention, the vacuuming experts from any house cleaning service bureaus always have a strategic cleaning plan to accomplish the total procedure at all time potential. So, make a subscriber base and straighten out the necessary ingredients that are would have to be done.

BSE Odisha Question 说:
2022年9月03日 15:38

Odisha 10th Previous Question Paper 2023 Download Students who have Started their Preparation for the Exam can also in the Pdf File Format, Whenever Students wish to revise After Completion of entire Portion, they can go Through All the Subject Guess Paper to have grip in every corner of the Subject, BSE Odisha Question Paper Provide Matric Latest and Last Year Exam Study Material for Syllabus, Question Paper etc, Hindi, English Medium Pdf Format.

登录 *

loading captcha image...
or Ctrl+Enter