Wednesday, December 5, 2012

[Rails] Bye-bye, Observers

Hiya

No more observers in Rails 4, farewell, never been much of a fan anyway.

However, one of my gems is enabling model attributes for use with a client-side WYSIWYM editor. The sanitized markup ends up in the database and has to be processed before shown in a view. The corresponding helper does fragment caching. This cache has to be zapped when the model is modified or deleted. And since the gem is generic, an observer for "after_update" "after_destroy" seemed the obvious choice for this.

What would be the Rails 4 state of the art approach do do this without using observers? Inject the above callbacks into the model directly?

-sven

--
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.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/PjOT5x0UFSkJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate