I'm still learning and can't figure out how to get a phone number out of my database and into a pdf document with some standard rails formatting. Specifically, in my controller my "define pdf" method includes: clientphone = "1234567890" pdf.text number_to_phone(clientphone) which generates an error reading undefined method `number_to_phone' I also tried pdf.text ActionView.number_to_phone(clientphone) which generates the same error. I'm not trying to use a template handler or anything tricky. I create a separate rails application to just output that one string formated as a phone number and it has the same error. Any help appreciated. Thanks, DAN
on 2007-01-08 22:27
on 2007-01-09 01:15
I believe I've determined that ActionView method can't go in the controller method. Calling number_to_phone even without using pdf writer creates an error which kind of makes since. No data manipulation can take place in the controller. Now I'm wondering about how to get the number_to_phone result returned to the controller method for output to the pdf file. I've been moving my code around so PDF::Writer.new is in a helper but then the send_data command which renders the file creates errors I think because it needs to be strickly in the controller. If I simply move the send_data command out of the helper and back into the controller it needs to receive the returned data to output. Without rendering a view, is returing a result from a helper method to a controller for output suppose to be even possible?