smallroomsoftware.com

Back in France

Posted on February 23, 2007

Vodka Tonics I'm back in France and we're getting rentability.com ready for a few days of face-to-face alpha testing and then we'll start a period of beta testing. Multi-unit properties (e.g. B&B) are in for beta now which is great.

Quite lovely to be back! It's a busy house but we're making progress. We must be working hard - I've been here over a week and we've played no Collin Mcrae (although that might have something to do with Josh's new Wii).

Shoe-horning beast into an existing app

Posted on February 05, 2007

This was easier than I though. Beast is a great piece of forum software written with rails. There is a thread on the forum about integrating beast into an existing app but no official advice on how to go about it. In fact, the official advice seems to be not to and to maintain a separate forum application. This is obviously ideal, but I want to reuse our user accounts on the forum. I couldn't think of a good way to achieve this. No-one seems to have attempted to build a shared login/single sign-on system in rails (at least I couldn't find one). I imagine most rails coders would not want that kind of extra complexity and not would I really. So I summoned up all my courage and decided to try to merge beast into rentability with as few hacky changes as possible.

In general it went pretty smoothly. I added beast's model, controller and helper classes, views and three plugins. I excluded the user controllel/model and views because I have my own, also based on acts_as_authenticated. I copied a few lines from beast's environment.rb into my own. Then I copied beast's routes into my own routes.rb. I had to change the routes quite a lot to accommodate our path prefix that we use to pass the current locale around - our URLs look something like www.rentability.com/en/controller/action/blah where the first element is the current locale. I wanted to keep this scheme on forum pages so I had to update all the routes. This is turn breaks all of beast's views because they use named routes like forum_path(forum) and I had to change them all to use a hash parameter: forum_path(:id => forum). Annoying. See the routes documentation in the rails docs for more info about that.

I had to update our user authentication code because it varies a lot from what acts_as_authenticated produces. For a start it uses some different column names (and has some additional ones) in the users table and uses :user_id as the session variable name rather than just :user (you'll need to change that to get beast's tests to pass).

Took about a day and half to iron out the problems and the result is great!

I'm definitely glad we have the forums incorporated like this. Running them as a separate application would have been quite limiting and would prevent us from integrating them more tightly with other parts of the site (or would at least have made it a lot more work to do so).

Hosting by site5.com