我在设计注册时收到此错误:
undefined method `users_url' for #<Devise::RegistrationsController:0x00000003b299b0>
使用 Omniauth facebook,登录,一切正常。
class User < ActiveRecord::Base
has_one :profile, :dependent => :destroy
after_save :myprofile
def myprofile
if self.profile
else
Profile.create(user_id: self.id, user_name: self.name)
end
end
end
class Profile < ActiveRecord::Base
belongs_to :user
end
使用设计注册进行此工作的解决方案可能是什么?
重要提示:它适用于 omniauth facebook,但不适用于设计注册。
编辑:我在 Profile.create 中收到此错误!方法:
NoMethodError - undefined method `users_url' for #<Devise::RegistrationsController:0x00000005946e20>:
actionpack (3.2.13) lib/action_dispatch/routing/polymorphic_routes.rb:129:in `polymorphic_url'
actionpack (3.2.13) lib/action_dispatch/routing/url_for.rb:150:in `url_for'
actionpack (3.2.13) lib/action_controller/metal/redirecting.rb:105:in `_compute_redirect_to_location'
actionpack (3.2.13) lib/action_controller/metal/redirecting.rb:74:in `redirect_to'
actionpack (3.2.13) lib/action_controller/metal/flash.rb:25:in `redirect_to'
Edit_2: Github存储库: https ://github.com/gwuix2/anabol
Github问题: