I have this Class which response to perform to be run by "Resque", I have an error
at this line recipient.response = response.body
wich is undefined method response=' for #<Hash:0x00000003969da0>
I think that because the worker and ActiveRecord can't work together.
P.S I already loaded my environment and this class placed in lib directory
Using: Ruby 1.9.2 Rails 3 Resque 1.10.0
class Msg
def self.perform(message,sender,host, path, recipient)
message_logger ||= Logger.new("#{Rails.root}/log/message.log")
response = Net::HTTP.get_response(host, path)
begin
recipient.response = response.body
recipient.sent_at = Time.zone.now
recipient.save
# Logging
log = "Message #{
message.sent_at}\n\tRespone:\n\t\tBody: #{response.body}\n\t\tCode: #{response.code}\n"
message_logger.info(log)
rescue Exception => e
message_logger.error(e.message + '/n' + e.backtrace.inspect)
end
end
end