Pregunta

Estoy trabajando en un complemento de hoja de tiempo simple para Redmine, todo iba bien hasta que intenté usar ayudantes.

El ayudante:

module TimesheetHelper
def first_day_in_week(datum)
  return unless datum.kind_of? Date
  datum - datum.wday
end
def last_day_in_week(datum)
  return unless datum.kind_of? Date
  datum + (6 - datum.wday)
end
end

En la vista, tengo a Helper "Hoj de tiempo"

Pero también lo he intentado

helper :timesheet

y

helper TimesheetHelper

En la primera línea de index.rhtml dice

<h2><%= l :timesheet_for %> <% first_day_of_week @week %> <%=l :and %>  
<% last_day_of_week @week %></h2>

y Rails lanza un nometoderror en first_day_of_week @week

¿Se me escapa algo?

¿Fue útil?

Solución

Tu método es

def first_day_in_week(datum)

no

def first_day_of_week(datum)

El nombre no es el mismo, por lo que el método no se encuentra ^^

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top