Authlogic不起作用
问题描述:
我有有以下3(用户名,密码,电子邮件)字段的表格。我想按照authlogic验证密码和电子邮件。但是我会根据我的意愿验证用户名。Authlogic不起作用
html.erb
<%= form_for @author do |f| %>
<%= f.label :username %>
<%= f.text_field :username %>
<%= f.label :password %>
<%= f.text_field :password %>
<%= f.label :email %>
<%= f.text_field :email %>
<% end %>
model.rb
acts_as_authentic //to validate (password and email fields)
acts_as_authentic do |u|
u.validate_username_field = false //avoid validating username field
end
这引发以下错误。
undefined method `validate_username_field=' for #<Class:0x0000000443cc78>
我在这里做什么?错
答
<%= form_for @author do |f| %>
<%= f.label :username%>
<%= f.text_field :username%>
<%= f.label :password%>
<%= f.text_field :password%>
<%= f.label :email%>
<%= f.text_field :email%>
<%端%> acts_as_authentication //验证(密码和电子邮件字段)
acts_as_authentic do |u|;
u.validate_username_field =假//避免验证用户名字段 端
它为我工作 – rails
我无法理解你想说什么。我遵循http://*.com/questions/2890652/an-authlogic-form-is-giving-me-incorrect-validation-errors-why – Sam