This method:
def admin_buttons
render :partial => 'portable/admin/admin_buttons'
end
returns this (not html_safe) when defined in ApplicationControler and made a helper with helper_method:
[“my partial’s output “]
But it returns the expected string normally when defined in ApplicationHelper.
I don’t understand. This is new behavior as far as I know in rails 3.1
Simply put, don’t call the controller’s
renderin helpers. It just does not work that wayrenderin the controller andrenderin a helper can’t be used interchangeably. This isn’t new in Rails 3.1.When you call
renderin the controller it eventually does callrenderon the view, the result of which is stored as itsresponse_body. The response body is eventually returned in the way Rack expects, as a string array (what you see as your output).These links may shed some more light on how this works:
– The controller’s definition of render (metal)
– It’s superclass method, where
response_bodyis set (abstract_controller)