Fix link for default widget

Convert single id to array to find item
This commit is contained in:
chris committed 2013-03-19 17:14:01 +08:00
1 parent 7dcea95dd4
commit 5e4e3ac560
2 files changed
+13 -11

No files matched your search

+4 -4
View File
@@ -9,15 +9,15 @@ module DefaultWidgetHelper
if(method_ary.has_key?(field) and (switch == true))
url = case method_ary[field][:args]
when nil # no args
get_data_link(method_ary[field]["method"], options)
get_data_link(method_ary[field][:method], options)
when :self # passing self
get_data_link(method_ary[field]['method'], options,row_data.id)
get_data_link(method_ary[field][:method], options,row_data.id)
else
ary = method_ary[field][:args].clone
object_hash = ary.each do |key,val|
ary[key]= type_trans_or_to_s(row_data.send(val[0]).send(val[1]))
end
get_data_link(method_ary[field]['method'], options,object_hash)
get_data_link(method_ary[field][:method], options,object_hash)
end
link_to row_data.send(field), url
@@ -50,7 +50,7 @@ module DefaultWidgetHelper
when NilClass
eval eval("#{method_entry}(#{options})")
when BSON::ObjectId
object = "'#{object.to_s}'"
object = object.to_s
eval("#{method_entry}(#{{:id => object}.merge options})")
when Hash
eval("#{method_entry}(#{object.merge options})")