Let's Build: With Ruby on Rails - Extending Devise Series - Adding Custom Fields
Web-Crunch
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 https://web-crunch.com 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 https://github.com/justalever/kickoff_tailwind. 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: https://web-crunch.com/extending-devise-custom-fields
====================
π° Subscribe: https://www.youtube.com/user/webcrunchblog?sub_confirmation=1
ππ€ NEW COURSE: HELLO RAILS - Get notified Https://hellorails.io
π» Previously published at: https://web-crunch.com/extending-devise-custom-fields
π» Check out the blog: https://web-crunch.com
π¦ Check out my personal site: https://justalever.com
π Links: Weekly Newsletter: https://web-crunch.com/subscribe Twitter: https://twitter.com/webcrunchblog Twitter(Personal Account): https://twitter.com/justalever Facebook: https://facebook.com/webcrunchblog Dribbble: https://dribbble.com/justalever Github: https://github.com/justalever Medium: https://medium.com/the-web-crunch-publication
πCheck out my book on UX Design: "LUXD: Learn User Experience Design" https://web-crunch.com/books/luxd
π Check out my FREE book on Tumblr Theming: "Pro Tumblr Theming" https://web-crunch.com/books/ptt
π― Need awesome web hosting? Check out cloudways. They allow me to use a variety of hosting providers and build apps with ease: http://bit.ly/webcrunchhosting
π Need more advanced hosting for Rails, PHP, Node, or other projects? Digital Ocean has you covered. https://m.do.co/c/ee243ee15648
π Ruby on Rails devs, Try HatchBox.io. You'll save upwards of 50% compared to Heroku. I use it and love it! https://hatchbox.io/?via=andy
βοΈ Or buy me a coffee https://www.buymeacoffee.com/webcrunch ... https://www.youtube.com/watch?v=3nFXKRF3GH8
94213071 Bytes