Category Archives: Ruby on Rails

Flex & Cairngorn & Rails Demo App

FlexOnRails have two (first, second) detailed posts on using WebORB for Rails with Flex. The demo app uses Adobe’s Cairngorm a framework for Flex and it’s Value Objects which can be mapped (through WebORB) to server side objects. Make sure to read the comments on the second post as Derek Wischusen explains the value of [...]

Flash image upload security with Ruby on Rails

When uploading a file through Flash every file comes through as with it’s .content_type as ‘application/octet-stream’ so you can’t check it using traditional methods*.
You can limit what kind of file is uploaded in ActionScript:
var allTypes:Array = new Array();
var imageTypes:Object = new Object();
[...]

Enable Rails development mode on a Media Temple’s (gs) container

Note this is for emergencies only development will suck up tons of RAM, expose errors/system paths, amongst other undesirable effects.
stop the app
mtr stop [appname]
set development mode
mtr set_option [appname] environment=development
start the app again
mtr start [appname]
debug your app (and fix it, woop!)
stop the app, set productin mode, start the app again; done!

WebORB in the Press

There’s a good introduction to using WebORB for Rails in Web Developer and Designer’s Journal. It gives a basic overview for the uninitiated while also highlighting some lesser know features such as retrieving Rails session objects and authentication (setCredentials), the latter being a fairly recent addition to WebORB.

Ensure that rails sessions remain valid over subdomains and https

If you’re using Active Record Store for your sessions (keeping sessions in a database) you may ‘lose’ your sessions when jumping to a subdomain or to a https connection (in my case it was the latter).
Here’s how to make sure your sessions don’t go walk about.
Add this line to your ‘config/environments/production.rb’ file
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_domain => ‘.mydomain.com’)
obviously replacing [...]

Use a partial form with form_for

I’m sure the cool kids know this already but it gave me a problem so I thought I’d post it.
When using “render :partial => ‘form’”, where ‘form’ is being rendered for a ‘new’ and edit ‘view’, you need to pass a local variable for your model object.
Originally I had
<% form_for :product, @product, :url => { [...]

Use javascript/prototype to get a text field value for link_to_remote

This one was a headache, and by headache I mean I was literally pounding my head on the desk trying to figure it out.
I wanted to use link_to_remote to create a model from another model’s form. The example being a ‘Product’ model that belongs to a ‘Group’, the user would select which group a product [...]

Media Temple Tames the Beast – New Ruby on Rails Hosting Service with Mongrel

For a long time deployment has been the giant stinky Grey elephant in the beautiful Ruby colored room. Rails makes developing an app a joy but for many, including me, deployment has been a bit of a nightmare. If you wanted shared hosting you went with folks who seemingly built their Rails set up by [...]

Debbugging Your Web Apps

Debugging has come a long way in the last few years, the current crop of tools is making web development faster and easier than ever before.
A great tool I found today is FireBug (late to the party as usual). It let’s you what’s going on under the hood of the browser including JavaScript, CSS, HTML [...]

The Ruby on Rails Rich Internet Application Software Development Kit by Adobe

Or RoRRIASDK, say that ten times fast!
The kit features six examples – and growing – of Flex/Fash with Ruby on Rails goodness including my Flash Remoting with Rails MP3 player tutorial. Big Ups to Mike Potter of Adobe for setting up the SDK and allowing me to contribute to it.
There’s also an Adobe PHP SDK [...]