Yeah, dedicated object to handle the business logic is what we do. You may 
take a look at Matt Wynne's Hexagonal Rails video - 
http://vimeo.com/44807822.

K. 

On Wednesday, October 31, 2012 1:02:28 AM UTC+2, Sebastian Porto wrote:
>
> Hi All 
>
> Someone please point me in the right direction with this. 
>
> I would like to implement an event / listener pattern in parts of my 
> application. But I don't quite like the Observer pattern as it is as it 
> hides the flow, I will like something explicit, where you trigger events 
> manually. See made up code below: 
>
>      class User < ActiveRecord::Base 
>          def something 
>              trigger :on_something, name 
>          end 
>      end 
>
>      class UserObserver < ActiveRecord::Observer 
>          def on_something(name) 
>              ... 
>          end 
>      end 
>
> I have been looking at 
>
> custom callbacks 
>
> http://api.rubyonrails.org/classes/ActiveSupport/Callbacks/ClassMethods.html#method-i-define_callbacks
>  
>
> Observers 
> http://api.rubyonrails.org/classes/ActiveRecord/Observer.html 
>
> But nothing quite does what I want, or I don't know how to hook it 
> together. Any suggestions / gems on this will be appreciated. 
>
> Thanks, 
> Sebastian 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rails-oceania/-/jjtyE8d2NAMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to