Following on from my last post for getting PostgreSQL up and running nicely on Mac OS X, my next task was getting it playing nicely with ruby on rails - I’m off on a rails course next week so I’m getting stuff ready.
It appears that there is currently two/three gem packages for using postgresql with ruby: postgres, ruby-pg, and pg - and from what I can make out, they’re all maintained by the same team now, (postgres was the original package, but it got abandoned - ruby-pg and pg are the replacements). As such, i’ll go with the newer ruby-pg gem…
sudo env ARCHFLAGS="-arch i386" gem install \
ruby-pg -- \
--with-pgsql-lib=/opt/local/lib/postgresql83 \
--with-pgsql-include=/opt/local/include/postgresql83
Then finally, when writing the database.yml entry for connecting to postgresql, we have to define our adapter as follows:
development:
adapter: postgresql
database: test_dev
encoding: unicode
host: localhost
user: XXXXX
password: XXXXX
timeout: 5000
A great little command-line tool for Leopard:
osx-trash manipulates the Mac OS X trash from the command line, just like the Finder does. It uses AppleScript via Scripting Bridge on top of to communicate with the Finder. You can move files to the trash, empty the trash, and list items currently in the trash.
project page via
First in a series of three articles from Apple on Ruby on Rails development on Mac OS X Leopard. Definitely worth a bookmark.
Ruby on Rails is a popular and powerful open source web framework for rapidly creating high-quality web applications to help you keep up with the speed of the Web. Rails is thriving on Mac OS X, and Leopard comes pre-installed with Ruby, Rails, Mongrel, Capistrano, Subversion, and other tools that help to streamline the development and deployment of Rails applications. In addition, the Organizer feature of XCode 3.0 keeps your development workflow efficient.
This article gives you a full tour of Ruby on Rails 2.0 on Leopard—starting with building a web application using the latest Rails features with Xcode 3.0, and finishing with deploying the application to a production server running Leopard Server. Along the way we’ll explore unique features and benefits that Leopard brings to the party. In the end you’ll be better equipped to consider the advantages of powering your web application with Rails on Leopard.
This is the first in a series of three articles:
- This article on Development, where you learn to build a basic RESTful Rails application using Xcode 3.0;
- Customization, where we discuss working with views and web forms, adding AJAX support, and supporting an iPhone interface;
- Deployment, where we set up version control, write a Capistrano recipe, and deploy on Leopard Server.
Together they will give you a great start in working with Rails on Mac OS X Leopard.
full article
This could be most useful in the near future…
Most web applications have many more model objects exposed on the backend, or admin side, than they do on the front. Coding interfaces for all those models is redundant and a waste of resources when all you need is CRUD functionality that’s smart enough to handle all your ActiveRecord associations.
ActiveScaffold is a Ruby on Rails plugin that provides you with a wealth of dynamically created goodness, just plug the ActiveScaffold into your controller, you can have a AJAXified table interface for creating, updating, and deleting objects then. It has the following main features as well.
- Automatic handling of ActiveRecord associations
- Sorting, Search and Pagination
- Graceful JavaScript degradation
- RESTful API support (XML/YAML/JSON) baked in
- Sexy CSS styling and theming support

via