Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Layout for Devise with scoped route

Rails • Asked by Nick McNeany

Hey Everyone,

I'm trying to use a custom layout for my devise/registrations#edit view. I'm using a scoped route.

devise_scope :member do
        get "/members/:id/settings" => "devise/registrations#edit", as: "edit_member_registration"

I call the layout in my registrations controller layout "member_area", only: :edit, but it's not showing.

I have a feeling it has to do with the scoped route. Also, if I take off the only: :edit the layout shows up on the other registration pages as expected.

Anyone have any thoughts on this?

Thanks for any help!


Hey Nick,

I'm still a bit foggy on devise and the routes, so this may not be the best way, but I had to do a similar setup where each user type had their own layout for the various devise functions and this is what has been working for that project:

devise_for :members, controllers: { registrations: 'members/registrations'}, :path => '', :path_names => {:sign_in => 'member_login', :sign_up => 'member_signup'}

Then for the views, you'll have a structure similar to this:

  • views
    • members
    • registrations
      • edit
      • new

And your controllers like:

  • controllers
    • members
    • registrations_controller.rb

Would love for someone with more expertise to chime in if there's a better way!

Hey Jacob,

Thanks for the help! Unfortunately I still can't get the layout to display. I think I'm just going to move onto plan b for now.

I really appreciate your help!


Doh, well sometimes that's how it goes until we have more time!

Something I forgot to mention in my original post was that the registrations_controller.rb doesn't need any layout specified, you just need to make sure to namespace the controller...

class Members::RegistrationsController < Devise::RegistrationsController

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.