Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Hanif Khairudin
2,818 PointsRuby on Rails Problem
I'm working on { Build a Simple Ruby on Rails Application => Designing URLs => Creating Custom Routes }
I'm stucked when try to add custom route for register and login url:
ActionController::RoutingError at /register uninitialized constant Devise::RegistrationController
block in constantize activesupport (3.2.13) lib/active_support/inflector/methods.rb
I tried to find solution on the internet but nothing works out yet.
missgeekbunny
37,033 PointsI'm with Brandon. It can be hard to fix something like this when you can't see the exact code. Wish I could be more help.
Hanif Khairudin
2,818 PointsThank your for your reply:
Treebook::Application.routes.draw do
devise_for :users
devise_scope :user do
get "register", to: 'devise/registration#new', as: :register
get "login", to: 'devise/session#new', as: :login
end
resources :statuses
root to: 'statuses#index'
missgeekbunny
37,033 PointsOnly thing that I can see different between yours and mine for the class is that you use double quotes after the get where I use single. Maybe that is where your problem stemming from.
Hanif Khairudin
2,818 PointsSolved. Noted that the :controller should be in plural =>
devise_scope :user do
get "register", to: 'devise/registrations#new', as: :register
get "login", to: 'devise/sessions#new', as: :login
end
1 Answer
John Paul Ashenfelter
1,118 PointsWay to solve your problem Hanif! Controllers in Rails are generally plural.
Brandon Barrette
20,485 PointsBrandon Barrette
20,485 PointsCan you paste what you are putting in your routes.rb file? Hard to give advice if I can't see what you've entered. Often times it's a simple typo.