On 26/11/2010, at 3:40 PM, Tim McEwan wrote:
Ha! Sorry, I spelled it wrong (ANZSIC). That was pretty much it though - except we want to go a level deeper than they display. Also I got the order wrong, it's group, then class.

I reckon I'd go with a non-numeric "id" field consisting of the letter
and number (so "A" for "Agriculture, Forestry and Fishing", A011
for "Nursery and Floriculture Production", etc).

You can easily reconstruct the hierarchy in memory, and since this
table won't ever get changed without a server restart, I'd load the
entire thing and build the hierarchy in memory and cache it in a
class variable. You can still use the real table for FK enforcement,
but you have the data in memory for validations... and if you ship
the whole thing to the browser as JSON, can build a UI for it there
and validate immediately.

It's important in my view that this kind of data ("reference data")
should be populated into a database table, even if you never plan
to update it.

Clifford Heath.

--
You received this message because you are subscribed to the Google Groups "Ruby or 
Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to