Let's Build: With Ruby on Rails - Extending Devise Series - Adding Custom Fields

Let's Build: With Ruby on Rails – Extending Devise Series – Adding Custom Fields



Hi, My name is Andy Leverenz and I work as a Product Designer at Dribbble. For fun, I design, code, and write. Check out my blog called Web-Crunch where I publish design and development tutorials with the occasional vlog.

====================

Devise is a ruby gem I use in nearly any Rails app. Authentication is a not so simple concept to master and as a result Devise has stood to be one of the most popular to help with this repetitive problem on Ruby on Rails applications.

This post is the first of many that will take a look at extending devise to work with you rather than against. My goal is to start off with the basics and then move into more advanced customizations like OmniAuth, inviting users, acting as users, and much more. I’ll be republishing this post as new installments get complete so in the end, there will be a larger collection.

To kick things off I’ll touch on adding custom fields to a given Devise install. Rather than adhering to the defaults that ship with the gem, we will extend it to include two new fields. One is a terms and conditions checkbox and the other being the location of a given user.

All of these fields are presented to the user when first signing up. I’ll extend the already generated devise view to include the new fields. As an added bonus, I’ll add in some geo-location (thanks to another gem) to pinpoint the user’s location during sign up.

### Prerequisites

In this tutorial I’m using a template I created previously called kickoff_tailwind. You can download it here It comes with some general configuration taken care of as well as installing the Devise gem itself. If you are brand new to devise I recommend [installing it on your own]( first to understand how it hooks into a given model within your Rails app.

Continue reading:

====================

📰 Subscribe:

💎🛤 NEW COURSE: HELLO RAILS – Get notified
Https://hellorails.io

💻 Previously published at:

💻 Check out the blog:

🦄 Check out my personal site:

🚀 Links:
Weekly Newsletter:
Twitter:
Twitter(Personal Account):
Facebook:
Dribbble:
Github:
Medium:

📘Check out my book on UX Design:
“LUXD: Learn User Experience Design”

📙 Check out my FREE book on Tumblr Theming:
“Pro Tumblr Theming”

💯 Need awesome web hosting? Check out cloudways. They allow me to use a variety of hosting providers and build apps with ease:

🌊 Need more advanced hosting for Rails, PHP, Node, or other projects? Digital Ocean has you covered.

💎 Ruby on Rails devs, Try HatchBox.io. You’ll save upwards of 50% compared to Heroku. I use it and love it!

☕️ Or buy me a coffee

3 thoughts on “Let's Build: With Ruby on Rails – Extending Devise Series – Adding Custom Fields

Leave a Reply

Your email address will not be published. Required fields are marked *