Displaying 1 result from an estimated 1 matches for "remove_commas".
2006 Jun 01
1
Automatted Getter/Setter
...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 there is some way I could do this more automatted like:
:attr_reader :sale_price, ...., ...., ....
Any help would be great... any...