Displaying 1 result from an estimated 1 matches for "format_as_select_opt".
2005 Dec 26
0
Why isn''t this working???
...ions = {}, pid = nil, level = 0, &block)
@@TreeListView_tree ||= self.find(:all, options)
list = @@TreeListView_tree.find_all { |e| e.parent_id == pid }.sort!
list.each do |e|
yield(e, level)
traverse_tree(options, e.id, level + 1, &block)
end
end
def Object.format_as_select_options(display_field = :name, value_field
= :id)
format_as_list do |e, level|
["-" * level + " " + (e[display_field] || ""), e[value_field]]
end
end
end
--
Posted via http://www.ruby-forum.com/.