This is a Ruby snippet that’s simple and something that I’ve found useful. When allowing users to enter multiline data in your web application, say through a textarea, there will most likely be line feeds. When a user hits the enter key they will expect the cursor to move to the next line. [...]
If you’re doing Rails development I came across a handy utility that I’d like to share. It’s the RubyGems documentation that can be easily accessed on your local machine. Simply run the following command at your command prompt:
gem_server
and an instance of WEBrick will start on port 8808. Accessing this through http://localhost:8808 will display an index [...]
Truncating text is a very handy utility when building web applications. This can come into play when displaying part of a blog post, forum post, comments, and so on. Luckily, Ruby on Rails has a nifty built-in helper method, intuitively named truncate. Let’s say you have the following string:
Hello, this is my [...]
I ran into my first MINOR problem with Bluehost this evening. It’s more of a Rails configuration problem than anything else. My ActionMailer class kept throwing the following error:
Errno::ECONNREFUSED (Connection refused - connect(2)):
In my environment.rb file I was using a fully qualified domain name for my ActionMailer settings. I decided to try localhost since I [...]
GoDaddy, you have been a royal thorn in my side. I can’t count the number of wasted hours I spent configuring and hacking away to get my Rails app working on your servers. That doesn’t include the numerous blog posts I wrote to help others get up and running with your troublesome service. [...]
I was recently playing around with Juggernaut, which is a very useful Rails plugin. If you’re building applications where the server needs to push data to clients then Juggernaut is worth a look. Under the hood it basically uses a Flash shim to open a persistent connection with the server and then events [...]
This tip is more of a hack than anything else. I recently ran into a problem with an app that had been running on GoDaddy for a couple of weeks. Then, out of nowhere, it completely stopped working. You couldn’t access any of the controllers without receiving the dreaded “Rails application failed [...]
This should actually be a post about how Java leads the way, but if you’re involved with any sort of development you already know that Java is a dominant force. This is a total geek link (as is most of the stuff I post), but I was so fascinated with the results that I [...]
I’ve heard great things about TextMate and have yet to give it a try. It’s supposed to be the standard for building Rails applications on OS X, but I’ve been using this nice little tool called RadRails. I’ve been very pleased with RadRails and its tight integration with SubVersion, Rails Generators, and even [...]
I’ve found myself relying more and more on Rails validators. I used to code funky validation logic in ColdFusion and even PHP to, for example, check to see whether or not a username already existed in the database. While this can be done at the database level or in the application (where I used to [...]