Wednesday, August 24, 2011

[Rails] Re: call a controller method from model

Angelo Cordova wrote in post #1018303:
> Well, the example I used is a little simple for what I really need.
>
> I have 4 models
>
> Model A, Model B, Model C, and Model D
>
> Everytime I update Model C, I have to update Model B
> Everytime I update Model D, I have to update Model B
>
> Everytime I update Model B, I have to update Model A, but this update
> depends on "which" model has updated Model B. if Model C has updated
> Model B I have to make some changes in Model A. But if Model D has
> updated Model B I have to make differnts changes in Model A.
>
> My problem is that I don't know how can I recognize which model has
> updated Model B to "switch" between actions to update Model A

Sounds like what you need is Key Value Observing (KVO). Too bad I know
of nothing like that anywhere in Rails. Plus it probably doesn't make
sense in a web application anyway.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html

Sorry, that wasn't exactly helpful, but maybe an interesting...
observation (pun intended). :)

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate