Forum: Ruby on Rails Fromcontroller to the url_for() representation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cbff7ea94c9b2c4d5f7cfefd25be9ae2?d=identicon&s=25 Just Someone (Guest)
on 2005-12-18 17:40
(Received via mailing list)
Hi,

I'm trying to generate the url_for parameters ina controller to pass
down to a view. And I want to pass in the link_to() params. One of the
things I need to pass is the :controller part.

So I'm in the controller itself, and I want to change the self.class
(or it's to_s represantation) to the format needed by link_to().

For example:

class MyController < ApplicationController
  def show_something
    the_controller = self.class # or self.class.to_s
    # here I want somethig like:
    @controller_to_use = transform_to_string(the_controller)
  end
end

Also, is there a way to call link_to() in a controller?

Thanks,

Guy.
This topic is locked and can not be replied to.