Rails3 Devise undefined method `confirmation_url'
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).
Generating confirmation url in custom devise mailer
For anyone hitting this issue - I had the same method missing issue when using mandrill_mailer to replace devise's customer mailer.
Using the above example above I fixed it like so
class DeviseMailer < MandrillMailer::TemplateMaile
# ..... mailer code in here here .....
private
def main_app
Rails.application.routes.default_url_options[:host] = Rails.application.routes.default_url_options[:host]
Rails.application.routes.url_helpers
end
end
Customizing the confirmation_url in Devise
I used this routing:
map.user_confirm 'confirm/:confirmation_token',
:controller => 'confirmations', :action => 'show'
And this ERB:
<%= link_to 'Confirm my account',
user_confirm_url(:confirmation_token => @resource.confirmation_token) %>
And got this nice link:
http://localhost:3000/confirm/RjOnrd5yNREEDwsEfiFa
Rails3 + Devise: edit_password_url spits out http//www.blah.com (No colon the http!)
I ran into this problem too. The issue (oddly) is that you're using a full URL in the default_url_options (:host => 'http://www.blah.com'). If you put www.blah.com instead it appears to work. I ran into this problem last night and this was the quickest fix for me.
Can't confirm account for subdomain. Using Devise confirmable and Rails 4
I managed to solve this by using the following in confirmation_instructions.html.erb. This works for my setup, since I'm using the Apartment gem:
<%= link_to 'Confirm my account', user_confirmation_url(confirmation_token: @token, subdomain: Apartment::Tenant.current) %>
Devise reconfirmable email on Rails
Can you try modifying as below :
<p><%= link_to _('Confirm my account'), confirmation_url(@resource, confirmation_token: @token, locale: 'en') %></p>
replace en with your locale
Verify : ActionController::UrlGenerationError in Devise::Registrations#create
Related Topics
Maintaining Cookies Between Mechanize Requests
Heroku Wrongly Detecting My Node App as a Ruby App
Difference Between 'Self.Method_Name' and 'Class << Self' in Ruby
Ruby Rails - Select Only Few Columns from the Data Base
Including a Ruby Class from a Separate File
How to Create an Array in Ruby with Default Values
How to or Should I Find an Object by the Object_Id Attribute in Ruby
Getting Typed Results from Activerecord Raw SQL
How to Add MAC-Specific Gems to Bundle on MAC But Not on Linux
Match String That Doesn't Contain a Specific Word
How to Get Attributes That Were Defined Through Attr_Reader or Attr_Accessor
Error Installing Nokogiri 1.6.0 on MAC (Libxml2)
Why Are My Bigdecimal Objects Initialized with Unexpected Rounding Errors
How to Share the Factories That I Have in a Gem and Use It in Other Project