I have the following code and I want to write any errors generated when running it to a log file.
How can I do that in rails?
def get_score
if status == "approved"
begin
metrics = Popularity.get_metrics(url,nil ,:resource)
update_column(:metrics, metrics.to_yaml)
update_column(:score,Popularity.score(metrics,:resource ))
reputation = reputations.build(:metrics => metrics)
reputation.score = score
reputation.save
rescue
#write the error that was raised to a log file
end
end