Topic: render from within a model

Ok at the moment Im wanting create pdf documents from within a model object using the rtex plugin.


Is this possible at all?  ( I realise it is non-standard )

Re: render from within a model

Looks like rtex is a view so it expects to be called from a controller. There's probably a way to call it from a model with a bit of hackery. What is your reason behind generating it in a model? Perhaps there's a better alternative.

Railscasts - Free Ruby on Rails Screencasts

Re: render from within a model

The reason is that I am trying to store it directly into a BLOB.

So imagine you have a invoices table and you want to store invoice pdf's but not display them to the user (they get emailed).  What I thought would be good is to create a method in the Invoice that gets called before_save.

I have now changed it to be in the controller but I think the other method would be a little cleaner (if it was possible)