Displaying 1 result from an estimated 1 matches for "url_sourc".
Did you mean:
url_source
2006 Apr 18
0
activerecord(mysql) and hash to unique count
...my question; all I know of is right now is to attempt to save, get a
unique error and then when handling the exception increment the hash
value (really a column in a table)
Is this bad? Or are there better ways?
begin
word = NumbersWord.new
word.word = w.strip
word.source = url_source
word.save
rescue
puts "ERR: Could not save system word (possible unique error)"
# Potentially, we need to update the record
found = NumbersWord.find(:first, :conditions => [ "word = ?", w ],
:limit => 1)
if found
found.occurrence...