Bob Smith
2010-Jun-22 06:42 UTC
I need to do some code that should be in a controller inside a render partial. How??
I have an app that will be making a customer list to go in a pdf. The pdf part wasn''t bad using wicked_pdf. The problem is keeping the controller code where it belongs. The app has a print method in the controller. It does a render partial to loop through each customer. Once there it needs to make lists of attendance for each of the last 3 years to be part of each customers page. This is different for each customer, so it needs to be re-run each time. This is the part I want to get out of the view. Any way to have another method in the controller to be run for each customer? -- 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.
Michael Pavling
2010-Jun-22 10:17 UTC
Re: I need to do some code that should be in a controller inside a render partial. How??
On 22 June 2010 07:42, Bob Smith <bsm2th-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The app has a print method in the controller. It does a render partial > to loop through each customer. Once there it needs to make lists of > attendance for each of the last 3 years to be part of each customers > page. This is different for each customer, so it needs to be re-run > each time. This is the part I want to get out of the view.Sounds like the Customer model might make a good place for the method to live. In the view you can call @customer.go_get_my_data ... -- 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.
Bob Smith
2010-Jun-23 21:18 UTC
Re: I need to do some code that should be in a controller inside a render partial. How??
Thanks. That should work fine.. Is there anything special to do to make the method seen in the view? Bob On Jun 22, 6:17 am, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 22 June 2010 07:42, Bob Smith <bsm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > The app has a print method in the controller. It does a render partial > > to loop through each customer. Once there it needs to make lists of > > attendance for each of the last 3 years to be part of each customers > > page. This is different for each customer, so it needs to be re-run > > each time. This is the part I want to get out of the view. > > Sounds like the Customer model might make a good place for the method > to live. In the view you can call @customer.go_get_my_data ...-- 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.
Michael Pavling
2010-Jun-23 21:33 UTC
Re: Re: I need to do some code that should be in a controller inside a render partial. How??
On 23 June 2010 22:18, Bob Smith <bsm2th-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks. That should work fine.. Is there anything special to do to > make the method seen in the view?As long as it''s a public method, it will be accessible wherever you have any instance of the class. -- 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.
dieinzige
2010-Jun-23 21:36 UTC
Re: Re: I need to do some code that should be in a controller inside a render partial. How??
as notes* at ruby, u va access to all methods of class, wherever u have any instance of this class =) =) Best Regards, Dieinzige On 23 Jun, 2010,at 09:33 PM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: On 23 June 2010 22:18, Bob Smith <bsm2th-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks. That should work fine.. Is there anything special to do to > make the method seen in the view?As long as it''s a public method, it will be accessible wherever you have any instance of the class. -- 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. -- 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.