Ruby on Rails problems & solutions - Jan 21, 2011


January 22, 2011

Routes and formats For some reason, I got stuck on this.  It’s not explicitly stated anywhere in the new routing documenation/guides, but if you need a format, it’s a parameter for your path: workbook_job_path(job, :format => ‘pdf’)

I actually had to go look at source code to find that. :-p

Whitespace stripping your form params You can get into a lot of interesting situations, if you don’t pay attention to details like this, in your Rails app.  Quite a few solution variations, some of which actually work:

http://railsforum.com/viewtopic.php?id=969

View Git file history Once again, fun with git.  I think I need a better Git client (currently using GitX).  Found my answer here:

http://stackoverflow.com/questions/278192/git-how-do-i-view-the-change-history-of-a-file

The solution:

git log -p filename


} else { $('#cookie-notice').show(); } $('#cookie-notice-accept').click(function() { createCookie('cookie-notice-dismissed','true',365); // Change from 1 month to 1 year. $('#cookie-notice').hide(); });