Hi all -
I’d like to implement a lookup table in my app that contains some
reference data, just some status codes and their descriptions. What’s
the most appropriate approach according to the “rails way” of doing
things? Would I just implement a has_many relationship? Let’s say
these are Order status codes, would the StatusCode have many Orders?
This seems right from a database POV (normalizing the code and
description into a separate table), but sort of goofy from a coding
POV. “Order belongs_to :order_status_code” seems a little off to me.
It would be nice if I could somehow automatically have the status
description automatically be added as a read-only attribute to the Order
Suppose the above approach is the correct one. Would I still use the
standard id column as my primary key, or just use the status code as I
normally would in a non-rails app? It seems like it would make sense to
do the latter, but would I regret going against rails conventions when
it is just as easy to go along with it?
Thanks for any insight into this. I’m having a blast learning Rails.