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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Just S. (Guest)
on 2005-12-18 18:40
(Received via mailing list)

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)

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


This topic is locked and can not be replied to.