On 18 December 2015 at 12:34, Travis Eubanks <[email protected]> wrote:
>> It is important to separate user interface issues from database
>> issues.  There is no need (from what I understand) to have both name
>> and gl code in the database as if you (the programmer) knows one then
>> you are able to determine the other.  If you want both on the UI then
>> that is no problem, just work the other one out when you need to
>> display it.
>
> OKay okay so basically instead of categorizing them by their name as a
> string just categorize them by their gl_code  and the gl_code is what
> will be saved in the db and I can just work out displaying the expense
> type name on the UI.
>
> The only thing is the employee that is inputing their expense doesnt
> always know the gl_code or if ever because to them its meaningless (to
> the endpoint person its important)
>
> So maybe When they choose what kind of expense it is make it a dropdown
> list with the Expense type name and the gl_code and then it'll just save
> the gl_code.
>
> This would be a belongs_to has_many relationship between expenses and
> gl_codes

That was not what I thought you were doing, I thought you were just
going to include the gl_code in the expenses table.  However there may
well be an argument for having an expense_types table with
Expense belongs_to expense_type
ExpenseType has_many expenses

In that case you could put both the string and gl code in the expense
type table and there is no need for any code to work out one from the
other.  Note the difference here is that each expense type will only
be saved in the db once so there is no redundant data.  As you
originally described it I thought you were going to save both gl code
and string in each expense record so there would be multiple instances
of each in the db.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvUfoP9OzVB%3DkeKpKdcD48KusF9s6KkaPHDvWYFLEw4SQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to