I have column LTD in my Company model. After retrieving value from model using
Company.find
If any value is present in LTD column, then I have to display the text “Limited” on the view. I have many columns in the model which are in the abbreviated form and when value is present their long form are displayed on the view. Therefore writing conditions on the view is not feasible.
I was thinking whether writing a custom rails config file containing application constants will do. But I don’t have quantitative and qualitative information on this.
Please help. Thanks in advance.
This works for me perfectly.
I have declared a global hash in
config/environment.rbwhich maintains the list of all the column name short-forms and long-forms and on the view I just check if value is present in the column I search for the corresponding key value pair from the global hash and display the long-form.Thanks guyz for giving your time to help me.