This project is archived and is in readonly mode.
View Helper Does Not Render In View Template
Reported by Conrad Taylor | September 18th, 2008 @ 12:11 PM | in 2.x
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.
Comments and changes to this ticket
-
Wesley Moxam September 18th, 2008 @ 03:26 PM
You misunderstand how 'render' works. The only way you can use render in a helper is if you're doing a render :partial.
-
josh September 18th, 2008 @ 03:44 PM
- 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 ;)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>