Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/06/2011, 15:26
Avatar de rasmarko
rasmarko
 
Fecha de Ingreso: noviembre-2002
Ubicación: México
Mensajes: 78
Antigüedad: 21 años, 5 meses
Puntos: 1
De acuerdo Respuesta: Render HTML (Rails)

No se preocupen, finalmente la función quedó así.

Código ruby:
Ver original
  1. def menu(location = 'header', bars = 1)
  2.    
  3.     menu = Menu.order("`order` ASC").where(
  4.            "location = ? AND published = ?", location, true)
  5.    
  6.     if menu.count > 0
  7.      
  8.       content_tag :nav, :id => "menu-#{location}" do
  9.         chunk_array(menu, bars).collect {|menu|
  10.           concat(content_tag :ul do
  11.             menu.collect {|item|
  12.               concat(content_tag(:li,
  13.                 content_tag(:a, item.name, :href => item.url))
  14.               )
  15.             }
  16.           end)
  17.         }
  18.       end
  19.            
  20.     end
  21.    
  22.   end

Gracias.
__________________
Fuentes - Diseweb - Frases Célebres