AWS+Rails: Devise Profile by User Role

Опубликовано: 18 Май 2026
на канале: BrainTrust Digital
3,326
80

In this AWS Rails Tutorial we are answering a subscriber question how to create dynamic profile pages by user role. To accomplish this we will add a Role model with a few roles: default, moderator, and contributor. Next we will use a technique I learned from my favorite Ruby on Rails tutorial creators to dynamically display the correct partial by current user role. We will take advantage of lookup_context helper specifically the template_exists method. This was a really fun tutorial to create, I hope I answered the question and helped a few people along the way!

⏰ Timestamps
0:00 Introduction
1:48 Create Role Model
3:07 Add Role Tasks
6:19 Add Relationships
7:06 Set Role for New Users
7:56 Test a new user
8:40 Output Role on Profile
9:29 Extract Profile Partial
10:16 Dynamic Profile First Pass
10:43 Better Dynamic Profiles
13:39 Surprise from my coworker
14:14 Different Role partials
15:33 View Different Profiles
16:20 Closing notes

AWS + Rails Series Playlist
   • AWS + Rails  

RailsCasts and GoRails videos that inspired this approach
http://railscasts.com/episodes/407-ac...
https://gorails.com/episodes/activity...

Devise Gem
https://github.com/heartcombo/devise

My Gear List
http://brain-trust.io/my-gear

My YouTube SEO Software
https://www.tubebuddy.com/braintrust

My Accounting Software
https://shareasale.com/r.cfm?b=960179...

Make sure you subscribe to my channel to keep up to date with new content!

DISCLAIMER: Links in this description include affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you! Thank you for supporting BrainTrust Digital so I can continue to provide you with free content each week!