We've moved discussions to Discord

What's a best practice approach for using two different view layouts with the Jumpstart template?

Brian Carpenter
I have what a suspect is a pretty common use case where I'd like to have a main marketing/landing page that has a different layout than my application pages.

I found the below thread on GoRails.com which makes sense, but also seems like overkill for my needs, but I'm not sure.  I'd prefer not to start changing how the controllers inherit in my Jumpstart template (as the thread recommends) if not needed. 

https://gorails.com/forum/rails-6-separate-styles-and-layout-for-dashboard-and-main-front-site

I was thinking I could probably just manage which views show up by doing some logic with my routes and checking some user_signed_in?  logic but this approach feels a touch "hacky".

Any suggestions from the forum?
Chris Oliver
As I typically do (and how Jumpstart is configured), we check in the routes and render a different view for the root if you're logged in or not.  We use Devise's authenticated :user route helper for that already in the Jumpstart Pro source code.

Fun fact, I actually added that feature to Devise 8 years ago! https://github.com/heartcombo/devise/blame/9aa17eec07719a97385dd40fa05c4029983a1cd5/lib/devise/rails/routes.rb#L314

Another common approach is you deploy a separate site for your homepage like Bridgetown or Jekyll and run the Jumpstart Pro app on app.example.com.
Notifications
You’re not receiving notifications from this thread.