Learning Devise for Rails

Learning Devise for Rails
eBook: $17.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $47.98    Print cover: $29.99
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Use Devise to implement an e-mail-based sign-in process in a few minutes
  • Override Devise controllers to allow username-based sign-ins, and customize default Devise HTML views to change the look and feel of the authentication system
  • Test your authentication codes to ensure stability

Book Details

Language : English
Paperback : 104 pages [ 235mm x 191mm ]
Release Date : October 2013
ISBN : 1782167048
ISBN 13 : 9781782167044
Author(s) : Giovanni Sakti, Hafiz Badrie Lubis, Nia Mutiara
Topics and Technologies : All Books, Application Development, Open Source

Table of Contents

Chapter 1: Devise – Authentication Solution for Ruby on Rails
Chapter 2: Authenticating Your Application with Devise
Chapter 3: Privileges
Chapter 4: Remote Authentication with Devise and OmniAuth
Chapter 5: Testing Devise
    • Chapter 2: Authenticating Your Application with Devise
      • Signing in using authentication other than e-mails
      • Updating the user account
      • Signing up the user with confirmation
      • Resetting your password
      • Canceling your account
      • Customizing Devise actions and routes
      • Customizing your Devise layout
      • Integrating Devise with Mongoid
      • Summary
      • Chapter 3: Privileges
        • CollabBlogs – a web application for collaborative writing
        • Advanced CanCan usages
          • Defining rules using SQL
          • Simplifying authorization checks on controllers
          • Ensuring abilities' correctness
            • Testing
            • Debugging
        • Summary
        • Chapter 4: Remote Authentication with Devise and OmniAuth
          • Remote authentication
          • OmniAuth
          • Implementing remote authentication in our application
            • Preparing your application
            • Remote authentication using Twitter
              • Registering our application at the Twitter developer site
              • Configuring OmniAuth for authentication using Twitter
            • Remote authentication using Facebook
              • Registering our application at the Facebook developer site
              • Configuring OmniAuth for authentication using Facebook
          • Summary
          • Chapter 5: Testing Devise
            • The sign-up test
            • The user update test
            • The user deletion test
            • The sign-in test
            • The Remote authentication test
            • Summary

            Giovanni Sakti

            Giovanni Sakti has been a developer for 10 years with an emphasis on developing web applications in Java and Ruby. His latest projects and research are focused on API-based web applications with AngularJS as the client-side framework. He is an active member of the Indonesian Ruby (id-ruby) community and sometimes gives talks about Ruby-related topics there. He writes regularly on his blog —http://mightygio.com— primarily about Ruby, Rails, AngularJS, and other programming topics. Giovanni is the founder of PT. Starqle Indonesia, a Jakarta-based company providing products, IT consulting, and development services with a focus on the healthcare industry.

            Hafiz Badrie Lubis

            Hafiz majored in Informatics Engineering at Bandung Institute of Technology, Bandung. He graduated in 2008. In his study period, he spent most of his time researching user interaction. It was a bit contradictive because he worked mainly in backend programming after he graduated. Most of his research was about ActionScript, PHP, and Javascript. About 2 years later, he came across Ruby on Rails, which sparked a lot more interest in web development. His interest was magnified after he took on the role of Chief Technology Officer in a startup (Wiradipa Nusantara) he built with his friends. Since then, most of his time was contributed to research on Ruby, Ruby on Rails, and web performance. He blogs extensively about Ruby and Ruby on Rails at http://hafizbadrie.wordpress.com. He has written a lot about best practices for using Ruby on Rails and also about web performance. Currently, he is a Lead Developer in The Jakarta Post Digital while maintaining his startup as a CTO in Wiradipa Nusantara. In recent days, he is paying more attention to the development of web performance from the server side with Ruby, the client side with JavaScript, and any other related strategy. He is a member of id-ruby (http://id-ruby.org), an Indonesian community that talks about Ruby and is also a member of Card to Post (http://www.cardtopost.com), an Indonesian community that mainly talks about postcards.

            Nia Mutiara

            Nia Mutiara is a software engineer working on a virtual stock gaming iOS application, as well as its server-side web application. For two years, she worked on complex Ruby on Rails and iOS applications. She is a master of JavaScript and CSS, and has used those skills to enhance most web applications that she has worked on. In her spare time, she hangs around Twitter, writes Ruby tutorials in Indonesian, and watches comedy.

            Code Downloads

            Download the code and support files for this book.

            Submit Errata

            Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


            - 3 submitted: last submission 06 Jun 2014

            Errata Type: Typo | Page number: 3

            Basic knowledge of relational
            databases such as Ruby, HTML, and CSS is also required

            should be replaced with

            Basic knowledge of relational databases, Ruby, HTML, and CSS are also required

            Errata type: Others | Page number: 9

            We will talk about this in more
            detail in Chapter 3, Privileges.

            should be replaced with

            We will talk about this in more
            detail in Chapter 4, Remote Authentication with Devise and

            Errata Type: Others | Page number: 13

            See it in action by visiting http://localhost:3000

            should be replaced with

            See it in action by visiting http://localhost:3000 (assuming that you already setup the root routes)

            Sample chapters

            You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

            Frequently bought together

            Learning Devise for Rails +    jQuery 2.0 Animation Techniques: Beginner's Guide =
            50% Off
            the second eBook
            Price for both: $34.50

            Buy both these recommended eBooks together and get 50% off the cheapest eBook.

            What you will learn from this book

            • Understand Devise as a flexible and customizable authentication solution for Rails
            • Customize sign-in, sign-up, password reset, email confirmation, account cancellation, and user account edit pages
            • Hide and show views based on defined user authorization rules using CanCan view helpers
            • Configure OmniAuth to make user sign-ins and sign-ups via social network accounts work on your Rails application
            • Use CanCan abilities to implement simple and SQL-based user privileges to restrict user access
            • Test authentications to ensure code stability

            In Detail

            There are numerous ways of implementing user sign-ins on your Rails web applications. Of those different ways, using Devise is one of the most popular, quick and flexible way to get user sign-ins working. It is extensible and plays well with other gems such as CanCan (for user privileges) and OmniAuth (for Facebook and Twitter sign-ins).

            A hands-on, all-in-one guide that gives you step-by-step instructions along with code examples to implement authentication systems in your application. This book will help you to implement various schemes of authentication systems including authorization and remote authentication, using Devise.

            Helping you make your Rails applications more accessible and user-friendly; this book explains how to implement user sign-ins in Rails. It will also show you how to customize user authentication pages, such as sign-in, sign-up, forgot password, and account details, by making use of existing Devise views. In addition, you will learn about facilitating complex privilege rules using the CanCan gem. Finally, you will discover how to make sure your authentication codes work as expected by using integration tests.

            You will learn all you need to know to create user email and social network sign-ins quickly, to customize user sign-in-related views, and implement complex privileges, as well as to ensure the stability of your authentication codes by testing them.


            A hands-on, step-by-step guide to using Devise for authentication in Rails.

            Who this book is for

            If you are a web developer who is getting started with Rails and you are looking for authentication solutions, then this is the book for you. If you are a current Rails developer who is looking to extend your authentication implementation with capabilities such as authorization and remote authentication, this book will also be great for you.

            Code Download and Errata
            Packt Anytime, Anywhere
            Register Books
            Print Upgrades
            eBook Downloads
            Video Support
            Contact Us
            Awards Voting Nominations Previous Winners
            Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
            Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software