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

Ruby

Ruby 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.

Can 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.

I'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.

Thank 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'

Only 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.

Solved. 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

Way to solve your problem Hanif! Controllers in Rails are generally plural.