Damaris Fuentes
2007-Jan-02 21:53 UTC
Customizing save or moving a method for better design?
Hi you all, I have a "wiki_controller" which gets the page''s title, summary, and content, stored them in a "Page" model However, I have to do a kind of parsing in the content to recover annotations made by the user, and stored them in the "Annotation" model. I do this with a method located in the "wiki_controller", which extracts each annotation and save them one by one. I wonder if I should move this method to the "annotation_controller", or if a should do the parsing when saving the page in the "Page" model, for what I would have to customize the default save that''s inside Rails for model (can I?) What would be the best option for a proper design?. Thank you -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Damaris Fuentes
2007-Jan-02 22:01 UTC
Re: Customizing save or moving a method for better design?
Btw, my question was partially answered here http://www.ruby-forum.com/topic/91753, but even though I opt for doing the parsing in the model, I don''t really know if modifying the save method would be the best idea. Thanks again. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Damaris Fuentes wrote:> Hi you all, I have a "wiki_controller" which gets the page''s title, > summary, and content, stored them in a "Page" model However, I have to > do a kind of parsing in the content to recover annotations made by the > user, and stored them in the "Annotation" model.Uh, why? Why not store raw Wiki markup in just one model? -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Damaris Fuentes
2007-Jan-04 19:47 UTC
Re: Customizing save or moving a method for better design?
> Uh, why? Why not store raw Wiki markup in just one model?Um, I don''t understand you :( I store the content in the Page model, as an attribute. The annotations written by the users in the way, let''s say, "blah blah {{my annotation}} bla bla blah", are extracted from that same content and stored in the Annotation model. The "extract" action is made in the Wiki controller (associated with Page model). Answers to the other post I made told me it would be better to set that action in the Annotation model. However, as I do the extraction after saving the page, I was wondering if I should do the action in the "save" method of Page model (not Annotation), and if I could, for that purpose, modify the "save" method of activeRecord by default in Page model. Thnaks again :D -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---