0
我有有以下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>
我在这里做什么?错
它为我工作 – rails
我无法理解你想说什么。我遵循http://stackoverflow.com/questions/2890652/an-authlogic-form-is-giving-me-incorrect-validation-errors-why – Sam