If you really want to use an existing Rails helper in your
controllers, do the following :

1. add the following the following code  to your
application_controller  (a singleton and a method):
  class Helper
    include Singleton
    include ActionView::Helpers::DateHelper
    include ActionView::Helpers::TextHelper
    # include other helpers
  end

  def helpers
    Helper.instance
  end

2. Use the helpers in your controller : @nice_string  =
helpers.distance_of_time_in_words(@t1,@t2)

Regards,
 MVCaraiman.

On Oct 31, 8:48 pm, Great John <rails-mailing-l...@andreas-s.net>
wrote:
> Hello, I'm pulling my hair out as I can't seem to find resolution to my
> simple problem, which is calling methods from controllers to helpers.
>
> in my application_controller.rb I have helper :all, which as i
> understand should include all helpers all the time.
> Then when i try to call methods in helpers i get undefined method error.
>
> Is there another place where i have to include helpers to make them
> available in controllers?
> --
> Posted viahttp://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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