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?

On 22 June 2010 07:42, Bob S. [email protected] 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

On 23 June 2010 22:18, Bob S. [email protected] 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.

Thanks. That should work fine… Is there anything special to do to
make the method seen in the view?

Bob

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 P. [email protected] wrote:

On 23 June 2010 22:18, Bob S. [email protected] 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.