Persisting a user session from RoR->PHP

Posted by Nicholas Thu, 10 Apr 2008 18:28:00 GMT

Recently I was given the task of integrating a (complete for all intents and purposes) PHP application with our main Ruby on Rails application. Because the PHP application needed to display a similar interface and required knowledge of the user’s account, I needed a way to access that data from the database both applications were now sharing. The only real requirement I had was that I absolutely didn’t want to make the user login to the PHP app if they were already authenticated on the Rails side of things as this seemed unnecessary and interrupted the flow things.

I did a bit of searching and, while I did find the wiki page on going from PHP -> Rails, I wasn’t able to find anything that fit my specific need, so I set out to roll my own. I read an article this morning from somebody who had ostensibly encountered the same problem as I, and was able to come up with a much different solution than what I had come up with. Therefore I thought it would be fun to share some of the details of my approach....


finish reading 'Persisting a user session from RoR->PHP'

Posted in php, tips, rails, ruby, code | no comments

Injured by Integer

Posted by Nicholas Sat, 05 Apr 2008 02:35:00 GMT

It’s been a very long time since I’ve used Kernel#Integer, but to my recollection it was simply coercion that raised an error if necessary, as an alternative to things like String#to_i which would simply return the first digits in a string, or 0 if the string did not contain a valid integer.

Since the program I was writing was receiving amounts in the form of strings representing cents, I figured it would be a natural fit. Leading zeros would be stripped off of anything under a buck, and I could simply rescue any ArgumentError and handle them appropriately....


finish reading 'Injured by Integer'

Posted in tips, ruby | no comments

Nothing or not

Posted by Nicholas Wed, 12 Dec 2007 19:22:00 GMT

Everyone loves writing web apps. They’re just amazing at doing everything. Ever.

One of the more interesting aspects of writing web applications is how often you see yourself doing the same thing over and over again....


finish reading 'Nothing or not'

Posted in rails, tips, code, ruby | no comments

Hiding mailto links from spiders

Posted by Nicholas Wed, 14 Feb 2007 18:30:17 GMT

More often than not I see sites that have a mailto link with an exposed email. This is setting yourself up to have your email harvested.

A quick and easy trick that you can use to hide emails from spiders is to replace the letters with html characters....


finish reading 'Hiding mailto links from spiders'

Posted in code, ruby, tips, spam | no comments