Brett Kelts - KeltexIS.com
2006-Sep-07 15:38 UTC
Where should I place my own helper classes?
I know this is a newbie question, but where in the rails tree should I place a my own helper classes? For example, I have a class called UserSchedule which loads data from different models in order to form a user''s schedule. Should that go in the models directory? components? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I would put your UserSchedule class directly in the model directory as you suggested. Think of the model as containing all the ''business logic'' of you''re app, not just the ActiveRecord::Base derivatives. If later, you end up wanting to share logic between applications, there are some helpful tips here, http://wiki.rubyonrails.org/rails/pages/TheBigPicture, on reusing your classes between applications. But for a single app, putting classes directly in model works fine. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
"UserSchedule which loads data from different models in order to form a user''s schedule" I put these kind of classes in the controller directory, because you are loading data from the db If you just calculate a few vars, i would put it in the model directory, the good thing is that you can access it from helpers, views, controllers. -- Heri R. http://sprinj.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 -~----------~----~----~----~------~----~------~--~---