Forum: Ruby on Rails Use ActionView stuff inside controller action

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.
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-01-23 18:06
(Received via mailing list)

I am too lazy to write an RHTML file. I just want to write an action,
and stuff a string. The string needs ActionView things inside it, like

  def lazy
     render :text => stylesheet_link_tag('application') + ...

How do I get lines like that working?

  Phlip  <-- NOT a blog!!
C515daf003a781a638d8a01e41a935a0?d=identicon&s=25 George Ogata (Guest)
on 2007-01-24 03:42
(Received via mailing list)
On 1/24/07, Phlip <> wrote:
> How do I get lines like that working?

  render :text => response.template.link_to('STFW',

You could also use method_missing to automatically delegate to

  def blah
    render :text => link_to('STFW', '')
  def method_missing(*args, &block)
    response.template.send(*args, &block)

Lazy enough for you?  ;-)
70225136eacd3d870f64e03bff678655?d=identicon&s=25 Russell Norris (Guest)
on 2007-01-26 16:28
(Received via mailing list)
Dear Phlip,

I am too lazy to respond.


[Heh. I couldn't resist. The devil made me do it.]
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-01-26 21:48
(Received via mailing list)
Russell Norris wrote:

> I am too lazy to respond.

That contradicts itself; you did respond.

The answers so far be...

 - render :inline => '...'
 - render :file => '...'
 - response.template.blah(), as George Ogata reports.

  Phlip  <-- NOT a blog!!
This topic is locked and can not be replied to.