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 […]

Installing Google Analytics into a Ruby on Rails 3.X

Installing Google Analytics into a Ruby on Rails app is pretty straight forward, however, the key is to only execute the analytics script in PRODUCTION environment. Without doing this, you’ll end up counting page views and visits on all your environments, e.g. development and test. Step – 1 Go to Google Analytics to create an […]