あと、flash見たいんで、app/layouts/application.html.erbも書き換えた。
diff。
app/helpers/users_helper.rb- options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname+ options.reverse_merge! :content_method => :email, :title_method => :email, :class => :nickname
app/controllers/sessions_controller.rb- @login = params[:login]+ @login = params[:email]- flash[:error] = "Couldn't log you in as '#{params[:login]}'"- logger.warn "Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}"+ flash[:error] = "Couldn't log you in as '#{params[:email]}'"+ logger.warn "Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}"
app/models/user.rb- attr_accessible :login, :email, :name, :password, :password_confirmation+ attr_accessible :email, :nickname, :password, :password_confirmation
app/views/layouts/application.html.erb<%= render(:partial => "users/user_status") %>+ <%= flash[:error] %>+ <%= flash[:notice] %>+<%= yield %>
app/views/users/new.html.erb<% form_for :user, :url => users_path do |f| -%>+<p><%= label_tag 'nickname', t('actionview.label.common.nickname') %><br />+<%= f.text_field 'nickname' %></p>+<p><%= label_tag 'email', t('actionview.label.common.email') %><br/>
app/views/users/_user_status.html.erb- <%= link_to_current_user :content_method => :email %>+ <%= link_to_current_user :content_method => :nickname %>
こんな感じ。
0 件のコメント:
コメントを投稿