I''m porting a bunch of sql queries used to generate reports of various kinds. I have a report controller that has no model and will contain all the actions that display report results. Where should I stick my wrapper methods for these queries. I don''t like having them stuck right in the middle of my controller action code. Would the helper module for the report controller be a good place? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, May 24, 2011 at 3:58 PM, Kevin <darkintent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m porting a bunch of sql queries used to generate reports of various > kinds. I have a report controller that has no model and will contain all > the actions that display report results. Where should I stick my wrapper > methods for these queries. I don''t like having them stuck right in the > middle of my controller action code. Would the helper module for the report > controller be a good place? >Why not place them in the most appropriate model? Helpers really should be in terms of helping you format your views per se, not business logic. You definitely dont want it in the controller if it is at all involved (and it should be if you are resorting to raw sql.> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24 May 2011 22:00, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> > > On Tue, May 24, 2011 at 3:58 PM, Kevin <darkintent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> I''m porting a bunch of sql queries used to generate reports of various >> kinds. I have a report controller that has no model and will contain all >> the actions that display report results. Where should I stick my wrapper >> methods for these queries. I don''t like having them stuck right in the >> middle of my controller action code. Would the helper module for the report >> controller be a good place? > > Why not place them in the most appropriate model? Helpers really should be > in terms of helping you format your views per se, not business logic. You > definitely dont want it in the controller if it is at all involved (and it > should be if you are resorting to raw sql.If there is no appropriate model then add one or more (not derived from ActiveRecord) to hold the code. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On Tue, May 24, 2011 at 4:58 PM, Kevin <darkintent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m porting a bunch of sql queries used to generate reports of various > kinds. I have a report controller that has no model and will contain all > the actions that display report results. Where should I stick my wrapper > methods for these queries. I don''t like having them stuck right in the > middle of my controller action code. Would the helper module for the report > controller be a good place? > >A model does not necessarily have to have an associated table. It is still the place you want to put business logic. So, go ahead and create a model for this stuff, just don''t have it inherit from ActiveRecord::Base. It won''t inherit from anything. Jamey -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.