Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
broke links with guid change. need to do tests for links
Browse files Browse the repository at this point in the history
  • Loading branch information
lusis committed Apr 27, 2011
1 parent 370b1ce commit bc9007b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/noah/models/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def find_or_create(opts={})

private
def node_to_class(node)
node.match(/^Noah::(.*):(\d+)$/)
node.match(/^Noah::(.*):(.*)$/)
Noah.const_get($1).send(:[], $2)
end
end
Expand Down
16 changes: 12 additions & 4 deletions lib/noah/routes/links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@ class Noah::App

get '/:link_name/:model_name/?' do |path, model|
link_name = Noah::Link.find(:path => "/"+path).first
(halt 404) if link_name.nil?
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?
end
(halt 404) if link_name.to_hash.has_key?(model.to_sym) == false
link_name.to_hash[model.to_sym].to_json
end

get '/:link_name/?' do |path|
link_name = Noah::Link.find(:path => "/"+path).first
(halt 404) if link_name.nil?
get '/:link_name/?' do |link|
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?
end
link_name.to_json
end

Expand Down

0 comments on commit bc9007b

Please sign in to comment.