Rails Devise: after_confirmation

I’m using Devise 3.1.2, it has a placeholder method after_confirmation which is called after the confirmation finished successfully. We just need to override this method in User model. class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable # Override Devise::Confirmable#after_confirmation def after_confirmation # Do something… end end See: Devise 3.5.9 Source Code: … Read more

how to install gems without sudo

Use chown on the whole .rvm and .gem directories back to your user. You probably used sudo before and it screwed up permissions. sudo chown -R username:group ~/.rvm sudo chown -R username:group ~/.gem Of course, change username to your username and group to your group

How do I extract Rails view helpers into a gem?

In my opinion, a full Engine is overkill for this task. You could instead just create a Railtie which includes your helpers into ActionView::Base when it initializes. # lib/my_gem/view_helpers.rb module MyGem module ViewHelpers def pre(text) content_tag :pre, text end def another_helper # super secret stuff end end end # lib/my_gem/railtie.rb require ‘my_gem/view_helpers’ module MyGem class … Read more