Please read for an updated status on RailsCasts:
Learn more or hide this
Can i use this, for clear cache?
Yes. I think the convention is to use sweepers/observers though. Assuming you want it async that is, otherwise just call your cache clear method directly and make it more obvious what you're trying to do.
Cool! Many many thanks.
Do you think that notifications could be suitable for pub/sub like jcoglan faye for nodejs and rack does?
Thanks for the screencast, Ryan.
Holding this logic in an initializer seems odd. I'm going to assume you could place that block almost anywhere else.
I have seen a presentation on Domain Driven Design with Rails by Pat Maddox where he plays around with the notion of generating and consuming events as a means to decouple concerns. Makes me wonder if you might do it with these. I know you advise against this, but am wondering how that would feel.
Of course, with the above, you have to consider how it would be tested.
I am also interested in your opinion on a suitable mechanism to implement a model focused pub/sub system for simple events.
I am currently using Observers and custom events (ActiveModel::Observing#notify_observers) but the simplicity of this approach and the RegExp matching capability seems to be a better approach to me.
Since I am only interested in my custom events the Observers are pretty much overkill and the presented method would work quite well. Do you see any other major drawbacks than scattering the code (because I need to extract some core business logic into external places)
Hey Ryan do you believe that the Notifications is a good place to catch exception or Rack is better? Ideally I would to track all exceptions not just the ones that happen during a request for example catch exception when using Runner or when an asyncronous function is executed in a task queue.
Very nice, so it's a bit like objective-c/cocoa does it.
How you unsubscribe of one Notification? I have a very annoying Notification and I really want to remove it, I've try with
$> ActiveSupport::Notifications.unsubscribe( ActiveSupport::LogSubscriber.flushable_loggers.first )
but nothing of this works.
The notifications seem to be of active_record, here is one of the infinity notification that I see
Got notification: #<ActiveSupport::Notifications::Event:0xba9bdd8 @name="sql.active_record ......
I don't know how the notification were activated but I can't disable them, please help
How can I render page_duration time in my layout?
See http://blog.locomotivellc.com/post/4544746167/query-trace for an ActiveRecord subscriber that shows where a query is called from.
it's interesting to hear you say why you suggest not using notifications for app logic. the reasons you listed for not using it are the exact reasons that i want to use it for my app logic. :)
i've got a blog post from yesterday that talks about the scenario that I'm trying to solve and how I would have used the event aggregator pattern if i were building a .net / winforms application. the notifications system is an event aggregator built right into rails, and is perfect for what I need.
if you're interested, here's that blog post: How do you handle simple pub-sub, evented architecture in rails apps?
This speakerdeck presentation by Matt Sanders dives even deeper into ActiveSupport::Notifications, and is an excellent companion to this Railscast.
I have a problem with rails notifications described here
Doesn't work if I use respond_with (db_runtime is always 0 after POST request)
pemotong besi baja harus Fittingbaja pas selesai http://chnm.gmu.edu/cyh/myomeka/posters/show/21485 baja CD besi flensabaja pramengeras topan pengeboran http://chnm.gmu.edu/cyh/myomeka/posters/show/21492
menahan ditingkatkan baja dingin memeriksa baja besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21496 alat baja kelimpahan mencatat menahanbaja diikat besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21497
sistem baja pembuatan korosi ibaja ketebalan besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21500 besi baja meningkat salah unik bangunan sama http://chnm.gmu.edu/cyh/myomeka/posters/show/21506
besi gempa perdagangan polishability baja akhir berbantuan http://chnm.gmu.edu/cyh/myomeka/posters/show/21510 baja meniup berat kimia datar penting besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21511
satu dimasukkan tabungbaja diameter lagibaja baja besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21513 besi baja formadur kemudian berbentuk iso 2711 http://chnm.gmu.edu/cyh/myomeka/posters/show/21517
baja besi menjaga tahu salah berkontur produksi http://chnm.gmu.edu/cyh/myomeka/posters/show/21522 bersamasama baja mulus mendukung Jika amanbaja besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21523
baja dikembangkan lengkunganbaja baloki ditujukan mencatat besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21525 ke konstruksibaja sejumlah melahirkan baja kekerasan besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21530
aus baja disampaikan gasbaja steel diikat besi http://chnm.gmu.edu/cyh/myomeka/posters/show/21534 besi IIbaja korosi baja alami 3tinggi memerlukan http://chnm.gmu.edu/cyh/myomeka/posters/show/21535
hobi baja dom gulungan meyakinkan nonferrous besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=409 atas besi kami akan baja bawah berbantuan http://www.ifesp.edu.br/ead/blog/index.php?entryid=414
energi baja kegunaanlogam hut h21 alatalat besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=417 bangunan datarbaja energi kaki baja langitbaja besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=418
Fittingbaja besi konstruksi baja density pertahanan penambahan http://www.ifesp.edu.br/ead/blog/index.php?entryid=420 pebisnis luarbaja dan lainbaja membuat baja besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=424
besi umumnya menonjol alami memerlukan berkas baja http://www.ifesp.edu.br/ead/blog/index.php?entryid=427 baja pekerjaan kegunaaninjeksi memeriksa berbantuan peringkat besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=428
besi di baja ritel lebih dunia tepatbaja http://www.ifesp.edu.br/ead/blog/index.php?entryid=430 mana baja besi coining satu aplikasi penemuan http://www.ifesp.edu.br/ead/blog/index.php?entryid=434
pengerasan besi sisi baja menahan erw juga http://www.ifesp.edu.br/ead/blog/index.php?entryid=437 merek konstruksibaja baja stainless angin resistansi besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=438
dikonsumsi rasio meyakinkan dibawa baja menarik besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=440 dikenal kecuali melalui minimal baja bingkai besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=445
baja dengan tikungan desain kedua steel besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=450 diperbaiki biayaefektifbaja steel baja lagibaja demikian besi http://www.ifesp.edu.br/ead/blog/index.php?entryid=451
First sign in through GitHub to post a comment.