Challenge - 5 Problems
Devise Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What is the primary purpose of the Devise gem in Rails?
Devise is a popular gem used in Rails applications. What main feature does it provide?
Attempts:
2 left
💡 Hint
Think about what users need to do to access a website securely.
✗ Incorrect
Devise is mainly used to add user authentication features like sign up, login, logout, password recovery, and more.
❓ component_behavior
intermediate2:00remaining
What happens when you add
devise :database_authenticatable to a User model?In a Rails app using Devise, adding
devise :database_authenticatable to the User model enables what behavior?Attempts:
2 left
💡 Hint
Think about how users prove their identity with a password.
✗ Incorrect
The database_authenticatable module handles storing encrypted passwords and verifying them during login.
❓ lifecycle
advanced2:00remaining
Which Devise callback runs after a user successfully signs in?
Devise provides callbacks during the user authentication lifecycle. Which callback is triggered right after a successful sign-in?
Attempts:
2 left
💡 Hint
This callback helps decide where to send the user after login.
✗ Incorrect
after_sign_in_path_for is called after a user signs in to determine the redirect path.
📝 Syntax
advanced2:00remaining
Which code snippet correctly adds the :confirmable module to Devise in the User model?
You want users to confirm their email address after signing up. Which code correctly enables this feature in the User model?
Ruby on Rails
class User < ApplicationRecord # Add devise modules here end
Attempts:
2 left
💡 Hint
Devise modules are symbols separated by commas inside the devise method call.
✗ Incorrect
Devise modules are added as symbols in the devise call. The correct syntax uses colons before each module name.
🔧 Debug
expert3:00remaining
Why does Devise raise a
MissingSecretKeyError in production?You deployed your Rails app with Devise to production, but it raises
Devise::MissingSecretKeyError. What is the most likely cause?Attempts:
2 left
💡 Hint
Devise needs a secret key to encrypt tokens and sessions securely.
✗ Incorrect
Devise requires secret_key_base to be set in production for encryption. Without it, this error occurs.