Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

View Helper Does Not Render In View Template

#1067

Hi, I have the following view helper in application_helper.rb:

Methods added to this helper will be available to all templates in the application.

module ApplicationHelper

def this_is_a_test

render :text => "This is a test"

end

end

When I attempt to call it from the view template

<%= this_is_a_test %>

It doesn't render anything in the browser. I have tried this in both FF 3 and Safari 3 without any success.

Reported by Conrad Taylor · September 18th, 2008 @ 12:11 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Wesley Moxam
    Wesley Moxam

    You misunderstand how 'render' works. The only way you can use render in a helper is if you're doing a render :partial.

    See: http://api.rubyonrails.org/class...

    September 18th, 2008 @ 03:26 PM

  2. josh
    josh
    • State changed from new to invalid

    If you want to use render with a string in a view template, try "render :inline => "..."". However, you could just return a string ;)

    September 18th, 2008 @ 03:44 PM