我正在尝试使用登录表单创建主页。登录工作正常,但注册按钮最终尝试登录用户,而不是按预期重定向到注册页面。这是我正在使用的代码。知道如何解决此错误吗?谢谢。
<div class="well sidebar-nav">
<br>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<%= f.text_field :login, :required => false, :autofocus => true, :placeholder => "Username or Email" %>
</div>
<div class="input-prepend">
<span class="add-on"><i class="icon-lock"></i></span>
<%= f.password_field :password, :placeholder => "Password" %>
</div>
<div class="btn-toolbar">
<div class="row-fluid">
<div class="span4" style="margin-left: 1.25%; width: 50%">
<button class="btn btn-success" type="submit">
<i class="icon-signin"></i>
<% f.submit 'Sign in' %> Sign In
</button>
</div>
<% end %>
<div class="span3" style="margin-left: -5%; width: 50%">
<button class="btn btn-success">
<i class="icon-pencil"></i>
<%= link_to 'Sign up', new_user_registration_path %> Sign Up
</button>
</div><!-- /span8 -->
</div><!-- /rowfluid -->
</div><!-- /btn-toolbar -->
</div><!-- /well -->
更新:事实证明,将注册链接放在按钮类之外解决了这个问题。