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> 

내가 여기서 뭘하고있는 거지 ??

답변

0
<%= 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 = 거짓 // 피할 사용자 이름 필드를 끝을 확인하는

+0

을 나를 위해 일한다 – rails

+0

나는 무엇을 말하고 싶은지 이해할 수 없다. 나는 http://stackoverflow.com/questions/2890652/an-authlogic-form-is-giving-me-incorrect-validation-errors-why를 따랐다. – Sam