On Mar 27, 2014, at 11:16 PM, Jeff wrote:
> I have an external process changing the database of my app. Is there a good way to trigger the before save and after save filters for models that get updated, when it is an external process changing it?
>
No. You would have to have some sort of timed process pinging the database for changes, and that's a stupid idea anyway -- think race conditions! The filters all run in Ruby, and without loading and executing your changes within the Rails environment, they will never "know" that anything happened in the database. They will only see the new values when they next load the objects from the database.
Try to think more about your overall application architecture. Maybe your "external process" can call an API in your Rails app instead of changing the database directly, behind its back.
Walter
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/739482be-f47b-441b-ba98-c6e07f848b55%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3143EAE6-BF40-42CF-9353-1EC743AFE694%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment