undefined method `user_registration_path'

2,188 views
Skip to first unread message

Krasimir Angelov

unread,
Jun 17, 2010, 1:39:51 PM6/17/10
to Devise
Hi,

I'm following the steps on http://github.com/plataformatec/devise. I
did

rails generate devise:install

and

rails generate devise User

but I'm getting an error saying

NoMethodError in Devise/registrations#new

Showing ~/myapp/app/views/devise/registrations/new.html.erb where line
#3 raised:

undefined method `user_registration_path' for #<#<Class:0xb569fa68>:
0xb569e578>
Extracted source (around line #3):

1: <h2>Sign up</h2>
2:
3: <%= form_for(resource, :as => resource_name, :url =>
registration_path(resource_name)) do |f| %>
4: <%= devise_error_messages! %>
5:
6: <p><%= f.label :email %><br />

Here are some details - http://gist.github.com/442433

Using Rails 3 beta 4 and Mongoid.

Any ideas why is this route helper undefined? There is
new_user_registration_path but no user_registration_path

rails console
irb(main):001:0> app.new_user_registration_path
irb(main):071:0" => "/users/sign_up"
irb(main):073:0> app.user_registration_path
NoMethodError: undefined method `user_registration_path' for
#<ActionDispatch::Integration::Session:0xb67210e4>
irb(main):074:0> app.registration_path
NoMethodError: undefined method `registration_path' for
#<ActionDispatch::Integration::Session:0xb67210e4>

Matt Slay

unread,
Jun 18, 2010, 10:15:49 AM6/18/10
to Devise
I'm not postive about this, but I ran "rake routes" to see what all
routes are defined for device controllers/actions, and I think you
should be using

new_user_registration_path to create new accounts

and

edit_user_registration_path to edit a logged in user account


I think that "user_registration_path" only maps to a HTTP PUT action,
which I think is the post-back handler for both of the above routes,
which are both GET actions.






On Jun 17, 12:39 pm, Krasimir Angelov <krasimir.ange...@gmail.com>
wrote:
> Hi,
>
> I'm following the steps onhttp://github.com/plataformatec/devise. I
> did
>
> rails generate devise:install
>
> and
>
> rails generate devise User
>
> but I'm getting an error saying
>
> NoMethodError in Devise/registrations#new
>
> Showing ~/myapp/app/views/devise/registrations/new.html.erb where line
> #3 raised:
>
> undefined method `user_registration_path' for #<#<Class:0xb569fa68>:
> 0xb569e578>
> Extracted source (around line #3):
>
> 1: <h2>Sign up</h2>
> 2:
> 3: <%= form_for(resource, :as => resource_name, :url =>
> registration_path(resource_name)) do |f| %>
> 4:   <%= devise_error_messages! %>
> 5:
> 6:   <p><%= f.label :email %><br />
>
> Here are some details -http://gist.github.com/442433

Joe Ellis

unread,
Jun 18, 2010, 11:14:07 AM6/18/10
to plataforma...@googlegroups.com
Can you post your output of rake routes?
--
Joe Ellis
squarefour | http://www.squarefour.net
504.383.4774
j...@squarefour.net

Krasimir Angelov

unread,
Jun 18, 2010, 1:20:58 PM6/18/10
to Devise
@Joe - rake routes output is in the gist - http://gist.github.com/442433

@Matt - new_user_registration_path & edit_user_registration_path are
for new and edit actions....The missing route is for the create
action.
In fact it is listed in rake routes output, but without name for the
helper

# POST /users(.:format)
{:controller=>"devise/registrations", :action=>"create"}

Regards,
K.

On Jun 18, 6:14 pm, Joe Ellis <j...@squarefour.net> wrote:
> Can you post your output of rake routes?
>
> On Thu, Jun 17, 2010 at 12:39 PM, Krasimir Angelov <
>
>
>
>
>
> krasimir.ange...@gmail.com> wrote:
> > Hi,
>
> > I'm following the steps onhttp://github.com/plataformatec/devise. I
> > did
>
> > rails generate devise:install
>
> > and
>
> > rails generate devise User
>
> > but I'm getting an error saying
>
> > NoMethodError in Devise/registrations#new
>
> > Showing ~/myapp/app/views/devise/registrations/new.html.erb where line
> > #3 raised:
>
> > undefined method `user_registration_path' for #<#<Class:0xb569fa68>:
> > 0xb569e578>
> > Extracted source (around line #3):
>
> > 1: <h2>Sign up</h2>
> > 2:
> > 3: <%= form_for(resource, :as => resource_name, :url =>
> > registration_path(resource_name)) do |f| %>
> > 4:   <%= devise_error_messages! %>
> > 5:
> > 6:   <p><%= f.label :email %><br />
>
> > Here are some details -http://gist.github.com/442433

José Valim

unread,
Jun 18, 2010, 2:09:04 PM6/18/10
to plataforma...@googlegroups.com
This seems to be a bug on latest Rails. There is an issue on Devise issues tracker with the exactly commit in Rails that introduced this failure.
--
José Valim

Director of Engineering - Plataforma Tecnologia
Know more about us: http://plataformatec.com.br/en/

Krasimir Angelov

unread,
Jun 18, 2010, 3:21:39 PM6/18/10
to Devise
Thanks for the explanation José.

If anyone is interested this is the issue that was mentioned -
http://github.com/plataformatec/devise/issues#issue/329.

Regards,
K.

On Jun 18, 9:09 pm, José Valim <jose.va...@gmail.com> wrote:
> This seems to be a bug on latest Rails. There is an issue on Devise issues
> tracker with the exactly commit in Rails that introduced this failure.
>
> On Fri, Jun 18, 2010 at 7:20 PM, Krasimir Angelov <
>
>
>
>
>
> krasimir.ange...@gmail.com> wrote:
> > @Joe - rake routes output is in the gist -http://gist.github.com/442433

José Valim

unread,
Jun 18, 2010, 4:17:02 PM6/18/10
to plataforma...@googlegroups.com
Thanks for posting the link. I was on my mobile device and the internet was too slow for me to pick it up! :)
Reply all
Reply to author
Forward
0 new messages