SVN: Attempted to lock an already-locked dir Error

So you’ve been working hard on your project and you’re ready to check in when all of a sudden Subversion throws you this weird error message: Attempted to lock an already-locked dir. “What the hell is this about?” you ask yourself. Well, Subversion is a really cautious fella and likes to bookkeep all of its transactions. [...]

Tags: , , ,

Installing Grails on Mac OSX Leopard

Here’s a quick tutorial to get Grails up and running on your Mac OSX machine:

Download the latest Binary from here.
To keep it clean, let’s unpack the archive and move the folder to /usr/share. Open up a terminal window and type: $ sudo mv ~/Downloads/grails-1.1 /usr/share
Change the permissions on these files $cd /usr/share
$sudo chown -R [...]

Tags: , ,

Populating Tables with Data Using Migrations

I can think of very few Rails sites that don’t need some kind of data pre-populated in their tables. When you talk to a Rails developer, the first thing that comes to mind when talking about populating the db is fixtures. This is not what we’re talking about here. Fixtures populate your TEST database with [...]

Tags: , , , ,

Rotating Ruby on Rails Log Files Using Logrotate

If you don’t pay much attention to the size of your log files in your production apps, you might want to take a look! If left alone, files such as production.log can grow quite large and bog down your application or server’s performance. In Linux, there is a tool called logrotate to help you manage [...]

Tags: , ,

Pass Additional Parameters to REST Named Routes

Here’s a quick one, but a useful reference nonetheless. How do you pass additional parameters to REST named routes?
Say you have the following route from the restful_authentication plugin:

map.logout ‘/logout’, :controller => ’sessions’, :action => ‘destroy’

This enables you to say something like this:

redirect_to logout_url

And if you want to pass extra params to that URL? It’s as [...]

Tags: , , , ,

Using Reserved Words in your Database Tables

I was banging my head against the wall the other day for several hours wondering why an extremely simple MyModel.find(:all) call was giving me the error: ArgumentError: wrong number of arguments (0 for 1).
There was absolutely nothing strange about the table, my controller, or model object. The next day it dawned on me, I thought [...]

Tags: , , , ,

Going from acts_as_taggable_on_steroids to acts_as_taggable_on Plugin

For one reason or another, once I upgraded my app to Rails 2.1, I started getting these mysterious “stack level too deep” errors. I’m not too sure what that even means, but I won’t get into it here. After diving into the stack trace for a little while, I noticed that the problem was with [...]

Tags: , , , ,

Ignoring Log Files in Subversion

If you’re like most people, you use Subversion for version control in your Rails app. So let’s say you have your SVN repository all set up, and you’re making changes to your code. Whenever you run your app, things are written to the log file(s). Log files can grow quite large, and they really don’t [...]

Tags: ,

Using Find Conditions on ActiveResource Objects

If you have a Rails app (app #1) which needs to communicate with another Rails app (app #2), chances are that app #2 is set up as a Web Service, and its controllers are RESTful, and that in app #1 you’re using ActiveResource. In case you’re not familiar with ActiveResource, please check out this excellent [...]

Tags: , , , ,

Use termios Gem With Capistrano to Keep Your Password Hidden

This is a quick tip, but a good one. If you use Capistrano to deploy your Rails app (which, umm, you really should) you will probably have noticed that your password is echoed on the screen when you deploy. This has always made me kinda nervous (I tend to have a mini panic attack every [...]

Tags: , , , , , ,