I have a database table, containing a large number of fields, among
which a bunch of i18n fields, like DESC_EN, DESC_FR, DESC_DE, etc. I
would like to dynamically select which one of these fields I will
return, by using SQL's "AS" pointing to the same field name:
DESCRIPTION_I18N.
My Rails code looks something like this:
### MODEL ###
def description_i18n
# The actual field is selected dynamically:
self[:desc_fr]
end
I have a database table, containing a large number of fields, among
which a bunch of i18n fields, like DESC_EN, DESC_FR, DESC_DE, etc. I
would like to dynamically select which one of these fields I will
return, by using SQL's "AS" pointing to the same field name:
DESCRIPTION_I18N.
does it not like the fact that you have 2 things that are identical
apart from the case?
Also won't this fail because the description_i18n method wants the
desc_fr field which isn't available with that name?