Archives

Posts Tagged ‘rails’

In a recent project I found myself writing recirect_to :back alot, and then found myself worrying that what if for some reason there is no :back. Drawing inspiration from this blog, I wrote two helpers in my application_controller.rb. The store_location stores current URI (or referer URI in case of non-GET request) into session[:return_to] for later […]

dets. 27th, 2012 | Filed under Programming
Tags: ,

I run into a case where I had User.search method and I wanted the GroupMember model be searchable by the user’s attributes. The most DRY way to accomplish this in Rails 3 is to merge scopes. In the User model:

NB! It’s important to have the User’s field names fully qualified so that they […]

dets. 17th, 2012 | Filed under Programming
Tags: ,

Facing the question which Ruby Rack server perform best behind Nginx front-end and failing to google out any exact comparison, I decided to do a quick test myself. The servers: Passenger 3.0.8 Unicorn 4.1.0 Thin 1.2.11 Later I tried to test UWSGI server too as it now boasts built-in RACK module, but dropped it for […]

aug. 25th, 2011 | Filed under Programming

For those who have a unix mailserver with procmail-based vacation scripts AND users who do not feel comfortable editing .procmailrc AND you do not use any webmail software (that comes with a vacation plugin) this might solve your problem. http://github.com/borgand/RailsVacation/tree/master This is Ruby on Rails app that uses SFTP to set up/edit/remove vacation messages to/from […]

juuli 9th, 2009 | Filed under Programming