I am editing an app that I made few months ago, and I have Devise installed in it with :confirmable
enabled. I wanted to remove confirmable from my app, but my db schema already have confirmable built-in many migrations ago, and it is almost impossible to have a smooth rollbacks.
How can I remove confirmable from my app and allow user to sign up right away without having to click on confirmation email link? If it is impossible, is there a workaround?
User model:
class User < ActiveRecord::Base
attr_accessor :login
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
...
Schema:
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
...
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.string "username"
end
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
Just remove confirmable
from the parameters to devise
method in user.rb
And also remove the columns confirmation_token
, confirmed_at
, confirmation_sent_at
and unconfirmed_email
using migrations as they are no longer needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With