On 1 March 2011 18:41, Inverted <br...@companyline-inc.com> wrote:
> Hello, in my controller I need to format a json object using
> simple_format, which is why I need to include several helpers.
>
> Any ideas on how to add it in?

Coincidentally, I had to resort to using number_to_currency in a
controller the other day (okay, I didn't *have* to - I decided it
easier to do it that way for the task I had to do :-)

A quick Google for "number_to_currency controller" (now I'm giving
away my Google-fu?!) gleaned this:
http://lojic.com/blog/2007/07/27/using-helpers-inside-controllers-in-ruby-on-rails/

..and for my quick and "I feel dirty" use, I settled for the solution:
Object.new.extend(ActionView::Helpers::NumberHelper).number_to_currency(my_number)

HTH

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to