Francis Ouellet
Francis Ouellet

Reputation: 505

Devise registration controller conflict with my own "registrations" controller

I'm in a bit of a pickle here as I have used Daniel Kehoe's excellent Rails Composer to build a small app. I'm also using Devise for authentication.

I had the bright idea to create a "registrations" controller/model to enable my users to register to different classes they want to attend. Obviously, this is wrecking havoc in my app and I'd like to know what is the best way to get out of this said pickle :)

I'm left with two choices and would like to have you Rails experts chime in:

  1. Rename my registrations controller and leave Devise alone (I'm guessing this is better in the long run if Devise is updated etc..)
  2. Change how the Devise routes are named in the config/routes.rb file.

What change should I plan on doing?

Thanks for your help!

Francis

Upvotes: 1

Views: 555

Answers (1)

John
John

Reputation: 4382

Wrap your registrations controller in a module/namespace.

Classroom::RegistrationsController
end

Then make sure the views of the registrations controller are inside a directory of classroom.

-views
--classroom
---registrations
----new.html.erb

In your routes.rb, put the regsitration routes in a namespace.

namespace :classroom do
 resources :registrations
end

Upvotes: 1

Related Questions