How do I set up email confirmation with Devise?

1. Make sure you include confirmable in Model.devise call class User < ActiveRecord::Base devise :database_authenticatable, :confirmable … end 2. Make sure you add confirmable to the user migration create_table :users do |t| t.database_authenticatable t.confirmable … end If you’re using devise 2.0+ this fails because devise no longer provides migration helpers, and so t.confirmable raises an … Read more

How do I remove the Devise route to sign up?

you can do this in your model # typical devise setup in User.rb devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable change it to: devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable notice that the symbol :registerable was removed That’s it, nothing else is required. All routes and links to registration page are magically removed too.

Create a devise user from Ruby console

You can add false to the save method to skip the validations if you want. User.new({:email => “guy@gmail.com”, :roles => [“admin”], :password => “111111”, :password_confirmation => “111111” }).save(false) Otherwise I’d do this User.create!({:email => “guy@gmail.com”, :roles => [“admin”], :password => “111111”, :password_confirmation => “111111” }) If you have confirmable module enabled for devise, make sure … Read more

Heroku/devise – Missing host to link to! Please provide :host parameter or set default_url_options[:host]

You need to add this to your environment.rb config.action_mailer.default_url_options = { :host => ‘localhost’ } Make sure you change host to your production url and keep it localhost for development. This is for the mailer, it needs a default email to send out notices such as confirmations etc… You should check the logs on the … Read more

Override devise registrations controller

In your form are you passing in any other attributes, via mass assignment that don’t belong to your user model, or any of the nested models? If so, I believe the ActiveRecord::UnknownAttributeError is triggered in this instance. Otherwise, I think you can just create your own controller, by generating something like this: # app/controllers/registrations_controller.rb class … Read more

No route matches “/users/sign_out” devise rails 3

I think the route for signing out is a DELETE method. This means that your sign out link needs to look like this: <%= link_to “Sign out”, destroy_user_session_path, :method => :delete %> Yours doesn’t include the :method => :delete part. Also, please note that for this to work you must also include <%= javascript_include_tag :defaults … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)