Help with this code

Assignment from 'here document' (document directly embedded in the source)

has examples.


this is because your display_products returns category.productos which is an Array (sort of)

This is the last statement in your method. The each loop is basically spinning it’s wheels.

ret = “

  • ” # Makes a new string at the beginning of each loop

    ret << “

  • At the end of the block you have a string. But you don’t do anything with it.

    Perhaps if you collected the results of each loop in an array and then joined them. eg

    def display_products(category) do |p|
        ret = "<li>"
        ret << link_to_remote( "<span>#{p.nombre}</span>",

    => “prod_id”, :id =>},


    => ‘info’)

        ret << "</li>"


    This would return the finished string at the end of the method.

    There has to be a cleaner way though. Like just appending to the view buffer directly.

    Hope this helps