Assignment from 'here document' (document directly embedded in the source)
http://ruby.about.com/od/learnruby/p/here_document.htm
has examples.
Hugh
Assignment from 'here document' (document directly embedded in the source)
http://ruby.about.com/od/learnruby/p/here_document.htm
has examples.
Hugh
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 = “
…
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)
category.productos.map do |p|
ret = "<li>"
ret << link_to_remote( "<span>#{p.nombre}</span>",
:url=>{:action
=> “prod_id”, :id => p.id},
:update
=> ‘info’)
ret << "</li>"
end.join
end
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
Daniel