The hierarchy of ANZSIC codes can be pretty confusing - if you know what
your final selection should be, it's not always obvious which options lead
to it. A search box -might- be a more user-friendly option - giving direct
access to the group means you could use a callback to save the
'division>sub-division>class' as a string on the group model, and only use
one query. Of course you'll still need to store all levels in the hierarchy
in the table.

On Fri, Nov 26, 2010 at 3:52 PM, Clifford Heath <[email protected]>wrote:

> 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]<rails-oceania%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
>

-- 
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