lib/hashbrowns/helpers/links_helpers.rb in hashbrowns-0.2.2 vs lib/hashbrowns/helpers/links_helpers.rb in hashbrowns-0.2.3

- old
+ new

@@ -1,11 +1,12 @@ module HashBrowns module LinksHelpers def linkify(key, value, parent = false, id = false, text = false) - return "" if value.nil? or key.nil? or !value or !key + return "" if value.nil? or key.nil? + return "false" if value == "false" + #puts "k #{key}, v #{value}, p #{parent} i #{id} t #{text} vc #{value.class}" key, value, parent, id, text = key.to_s, value.to_s, parent.to_s, id.to_s, text.to_s text = value if text - #puts "k #{key}, v #{value}, p #{parent} i #{id} t #{text}" return link_to(text, HashBrowns.conf.link_parents[parent][key]+value).html_safe if parent && HashBrowns.conf.link_parents.has_key?(parent) && HashBrowns.conf.link_parents[parent].has_key?(key) return link_to(text, HashBrowns.conf.link_hash[key]+value).html_safe if HashBrowns.conf.link_hash.has_key?(key) return link_to(text, value).html_safe if HashBrowns.conf.links.include?(key) return link_to(text, HashBrowns.conf.link_parents[parent]["id"]+id).html_safe if id && parent && HashBrowns.conf.link_for_id.has_key?(key) && HashBrowns.conf.link_for_id[key].include?(parent) return value