Commit bc9007be authored by John E. Vincent's avatar John E. Vincent

broke links with guid change. need to do tests for links

parent 370b1cee
...@@ -79,7 +79,7 @@ module Noah ...@@ -79,7 +79,7 @@ module Noah
private private
def node_to_class(node) def node_to_class(node)
node.match(/^Noah::(.*):(\d+)$/) node.match(/^Noah::(.*):(.*)$/)
Noah.const_get($1).send(:[], $2) Noah.const_get($1).send(:[], $2)
end end
end end
......
...@@ -2,14 +2,22 @@ class Noah::App ...@@ -2,14 +2,22 @@ class Noah::App
get '/:link_name/:model_name/?' do |path, model| get '/:link_name/:model_name/?' do |path, model|
link_name = Noah::Link.find(:path => "/"+path).first link_name = Noah::Link.find(:path => "/"+path).first
if link_name.nil?
# So maybe they forgot to add the path with a leading slash?
link_name = Noah::Link.find(:path => path).first
(halt 404) if link_name.nil? (halt 404) if link_name.nil?
end
(halt 404) if link_name.to_hash.has_key?(model.to_sym) == false (halt 404) if link_name.to_hash.has_key?(model.to_sym) == false
link_name.to_hash[model.to_sym].to_json link_name.to_hash[model.to_sym].to_json
end end
get '/:link_name/?' do |path| get '/:link_name/?' do |link|
link_name = Noah::Link.find(:path => "/"+path).first link_name = Noah::Link.find(:path => "/"+link).first
if link_name.nil?
# So maybe they forgot to add the path with a leading slash?
link_name = Noah::Link.find(:path => link).first
(halt 404) if link_name.nil? (halt 404) if link_name.nil?
end
link_name.to_json link_name.to_json
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment