The newest version of Devise doesn't have :confirmable enabled by default. I already added the respective columns to the User model but cannot find any code examples of how to enable :confirmable.
Where can I find a good example or what code do I need to enable it?
to "enable" confirmable, you just need to add it to your model, e.g.:
after that, you'll have to create and run a migration which adds the required columns to your model:
see: Adding confirmable module to an existing site using Devise
I'd recommend to check the source code to see how Confirmable works:
https://github.com/plataformatec/devise/blob/master/lib/devise/models/confirmable.rb
You could also check the RailsCast on Devise:
http://railscasts.com/episodes/209-introducing-devise
Next it would be best to search for example applications on GitHub
If you've already installed devise into your app, and want to add "confirmable" later, instead of running:
as mentioned by Piotr, run
to produce only the views needed for "confirmable". You'll see output like this:
You'll then be able to access these files directly in your project to style them like your application. You'll also be able to change the messaging in the emails Devise sends out through the generated mailer views.
Last, don't forget to add config.action_mailer.delivery_method and config.action_mailer.smtp_settings in your app/config/environments/{environment_name}.rb file. This is what my production.rb file looks like:
For DRY, you can also put mailer config in config/initializers/mail.rb like:
This question seems to be odd one ;-) If you written some migration alike:
and as you said little change in model (passing additional => :confirmable to devise) like so:
you can now generate some views (if you didn')
You can go to app/views/devise/confirmations/new.html.erb and check how it looks like or change it. Furthermore you can inspect app/views/devise/confirmations/shared/_links.erb => there is line:
This condition checks if confirmable is turned on so... technically if everything went fine it should works OOTB. After creating new account - in log - you should see lines where confirmation mail is sent with appropriate link. It triggers:
so you have got next place where you can customize it a bit
How to customize confirmation strategy? Please ask exact question what do you want to achieve. You can check devise gem path. In /lib/devise/models/confirmable.rb some comments could be helpful.
regards
Checkout devise wiki page. There is a full answer for your question.
After configuring the ActionMailer setting described above I had to make one last addition to the config/environments/development.rb file to fix an error page that would show up after registering a new user:
config.action_mailer.default_url_options = { :host => 'localhost' }
More details about this solution: Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]