Bob Wentz
unread,Jul 27, 2010, 7:49:32 PM7/27/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Devise
I'm using Devise 1.0.8 with Rails 2.3.5 with the Confirmable module.
I'd like to have all my URLs start with a locale prefix, so I have my
route configured as:
--------------------
map.devise_for :users, :path_prefix => '/:locale'
--------------------
I also have this in my devise.rb:
--------------------
config.default_url_options do
{ :locale => I18n.locale }
end
--------------------
And this in my application controller:
--------------------
def self.default_url_options
{ :locale => I18n.locale }
end
--------------------
However, when I try to create a new User object, the operation fails
with this error:
--------------------
ActionView::TemplateError (user_confirmation_url failed to generate
from
{:action=>"show", :confirmation_token=>"uQpzIKGcllh3GOufIK6j", :controller=>"confirmations"},
expected: {:action=>"show", :controller=>"confirmations"}, diff:
{:confirmation_token=>"uQpzIKGcllh3GOufIK6j"}) on line #5 of /Users/
robertwentz 1/.gem/ruby/1.8/gems/devise-1.0.8/app/views/devise_mailer/
confirmation_instructions.html.erb:
2:
3: <p>You can confirm your account through the link below:</p>
4:
5: <p><%= link_to 'Confirm my account',
confirmation_url(@resource, :confirmation_token =>
@resource.confirmation_token) %></p>
(eval):20:in `user_confirmation_url'
devise (1.0.8) lib/devise/controllers/url_helpers.rb:32:in `send'
devise (1.0.8) lib/devise/controllers/url_helpers.rb:32:in
`confirmation_url'
devise (1.0.8) app/views/devise_mailer/
confirmation_instructions.html.erb:5
--------------------
I noticed that in the console, so I can do this:
--------------------
app.user_confirmation_url(:locale => :en, :confirmation_token =>
"abcdef")
--------------------
But not this:
--------------------
app.user_confirmation_url(:confirmation_token => "abcdef")
--------------------
I'm guessing I'm missing something pretty simple here, but I just
can't figure out what it might be. I'll also note that if I remove
the "path_prefix" option from devise_for, and remove the
default_url_options from devise.rb, creating the object is
successful. But I no longer get the locale on the Devise controllers,
and I'd like it to be consistent throughout the site.
Apologies for formatting - I'm not sure how to do code tags here.
Thanks in advance for your help.