Kann mir jemand sagen, was hier los ist:einen Lambda im Wert Teil eines Hash-Speicherung
value: -> f { view_context.fr_user_column(f) }
Dies ist aus einem größeren hash:
def self.columns
{
user: {
title: "Applicant",
value: -> f { view_context.fr_user_column(f) }
},
ch_rep: {
title: "CH Rep",
value: -> f { view_context.fr_ch_rep_column(f) }
}
}
, die in einem Verfahren verwendet werden, um erstellen Sie eine Tabelle:
def self.render_zable_columns(context, options = {})
self.columns.each do |key, col|
next if options[:except] && options[:except].include?(key)
col_options = {title: col[:title]}
col_options[:class] = "franchise_#{key}"
col_options[:sort] = col.key?(:sort) ? col[:sort] : true
if col[:value].present?
context.send(:column, key, col_options, &col[:value])
else
context.send(:column, key, col_options)
end
end
end
der Grund, warum ich frage ist, weil ich auch die CH rep, die nur ein anderer Name für das User-Modell ist ein d Ich versuche, den Tisch zu bekommen, die CH rep (Benutzer) Namen angezeigt werden, aber das funktioniert nicht:
value: -> f { view_context.fr_ch_rep_column(f) }