search for: insert_commas

Displaying 1 result from an estimated 1 matches for "insert_commas".

2006 Jun 01
1
Automatted Getter/Setter
Hey.. So I have a model that has a lot of number fields. Each of these go through a process when read in and read out to add/remove commas (between every three numbers) to make them more readable. The getter I currently have is like this: def sale_price Listing.insert_commas(read_attribte (:sale_price)) end and the setter is: def sale_price=(price) write_attribute(:saleprice, Listing.remove_commas(price)) end The trouble is there is at least 5 other fields that need the same thing done for them (and most likely more will be added in time). I was wondering if th...