Rails3 Devise undefined method `confirmation_url'

后端 未结 3 1862
傲寒
傲寒 2020-12-14 15:48

I\'ve seemingly set up Devise for my User authentication, with the :confirmable option set.

Everything seems to run fine when I run it in the browser, I sign up, go

相关标签:
3条回答
  • 2020-12-14 16:33

    It simply turned out that when I ran rails generate devise:views, it generated incorrect paths when compared to the routes devise_for :user generated. It also generated some other issues, such as the user_confirmation_url pointing to @resource, as the first parameter; when it shouldn't have.

    (I didn't want the question to be left unanswered, I'm unsure as to the typical etiquette. If I'm wrong in doing this, please let me know).

    0 讨论(0)
  • 2020-12-14 16:34

    I also had the same issue just doing restart my server do the job for me and this error removed.

    just do CTRL + c and then start your server using rails s

    0 讨论(0)
  • 2020-12-14 16:47

    As an additional, if you're using STI with Devise models, as I am, you can check via the type attribute. So, my code looks like this:

    <p><%= link_to 'Confirm my account', manager_confirmation_url(:confirmation_token => @resource.confirmation_token) if @resource.type == 'Manager' %></p>
    <p><%= link_to 'Confirm my account', subscriber_confirmation_url(:confirmation_token => @resource.confirmation_token) if @resource.type == 'Subscriber' %></p>
    
    0 讨论(0)
提交回复
热议问题