Thursday, 15 January 2015

ruby on rails - States that password_required? is an undefined method -



ruby on rails - States that password_required? is an undefined method -

i installed devise , omniauth according rails casts. understand little out dated, working until tried sign up. w/o using omniauth twitter feature.

the error

nomethoderror @ /users/sign_up undefined method `password_required?'

in user.rb

1 def password_required? 2 super && provider.blank? 3 end

i tried move userhelper file. didn't work.

here erb file

1 <h2> sign </h2> 2 <%= simple_form_for(resource, as: resource_name, 3 url: registration_path(resource_name)) |f| %> 4 5 <%= f.error_notification %> 6 7 <div class="form-inputs"> 8 <%= f.input :email, required: true, autofocus: true %> 9 <% if password_required? %> 10 <%= f.input :password, required: true %> 11 <%= f.input :password_confirmation, required: true %> 12 <% end %> 13 </div> 14 14 <div class="form-actions"> 16 <%= f.button :submit, "sign up" %> 17 </div> 18 <% end %>

you should phone call method resource instance:

<% if resource.password_required? %>

ruby-on-rails devise

No comments:

Post a Comment