How to get current_user in model and observer Rails

If you want to log the user who created, updates and delete a object in specific model.There is no default way to fetch the current user in models, current_user is always assigned in controllers (as per authentication plugins, restful_authentication, authlogic and devise). Found one way, by adding some steps in model/user.rb, we can get the […]

ActionView::Template::Error (undefined local variable or method `bootstrap_flash’ in production mode

Create a helper file as,   app/helpers/bootstrap_flash_helper.rb Add these snippet into the file, ——————————————————————————– module BootstrapFlashHelper ALERT_TYPES = [:error, :info, :success, :warning] def bootstrap_flash flash_messages = [] flash.each do |type, message| # Skip empty messages, e.g. for devise messages set to nothing in a locale file. next if message.blank? type = :success if type == :notice […]