Is it possible to specify the column for an attribute? I have something like:
NAME, COUNTRY
The database is quite large and I have over a thousand columns which are capitalized like this. I want to refer to them as so:
attr_accessible :name, :country
Where :name = column NAME. I’d prefer Model.name rather than Model.NAME. It isn’t possible to downcase every column name in the structure file.
Here is an idea to do the way you preferred.
Command to generate migration:
(In my example, im applying this on
Poststable. Change according to your table name)Below is the migration
upmethod. Here taking all the column names and for each one I’m applyingrename_columnto make it downcase.As i didnt run it personally, it might need some changes. So start with it and let me know if facing any problem.