Fernando Lujan wrote:> I want to code the following task:
>
> I have a class, for instance, class A with is a observable.
>
> I want to add a controller of my rails system to this class. So I can
> notify_observer, and it updates all controllers of my system.
>
> How do I pass a controller as a parameter to the add_observer()
> method? And where I put this code?
>
>
To develop a chat application I have a external class that notify every
user in the chat about a new conversation.
I''m using observer pattern. Now, I want to create a controller in my
rails app. And notify this controller to change the view when it
receives a new action.
How could I implement this?
I need to pass a instance of my classto the controller initialize method.
def initialize(observable)
observable.add_observer(self)
end
Where I initialize this instance of my class?
Thanks in advance.
Fernando Lujan