I've just broken my existing way of getting growl-style notifications from a delayed_job, and opening up someone else's gem and hacking around isn't getting me anywhere. So I wondered: what's a sensible way to get notifications from a background task. Currently I'm using gritter_notices with a ruby class like this (but I've done something to stop it working... and the documentation's not in my native tongue...)
#User.rb
has_gritter_notices
class DoThing
def run_thing(books, template, client, user)
# some code
User.find(user).notice "<a href='/archives' target='_blank'>View Archive</a>", :level => :notice, :sticky => true, :title => "Things generated."
end
handle_asynchronously :run_thing
end
ps The error I'm getting is ActiveRecord::RecordInvalid: Validation failed: Text can't be blank
.
Oh, ignore me. I'd turned on whitelist_attributes:
config.active_record.whitelist_attributes = true
and the gem doesn't have its attributes whitelisted with attr_accessible
.