ActionPack: number_to_phone error

Question about the number_to_phone function as provided by rails in
actionpack:

If I do this in my controller:
num = number_to_phone(params[:phone_number])
I get this error:
undefined method `number_to_phone’ for
#TicketsController:0xb7a2bfcc

Whereas if I do this in my view:
<% phone_number = number_to_phone(@phone_number.phone_number) %>
<%= text_field ‘phone_number’, ‘phone_number’, {
:value => phone_number,
:size => 12, } %>

It works as advertized. Does anyone have any idea why?

Thanks,
Peter

(**********************************************************

I believe it is because a helper by definition is only available for use
in
your view, not in your controller.

-Kyle

On 8/14/06, Kyle S. [email protected] wrote:

I believe it is because a helper by definition is only available for use in
your view, not in your controller.

-Kyle

You are correct. That’s what it was.
Adding this to my controller (application.rb or an individual
controller) made it available:
include ActionView::Helpers::NumberHelper

Thanks!

(**********************************************************