Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
bc9007be
Commit
bc9007be
authored
Apr 26, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
broke links with guid change. need to do tests for links
parent
370b1cee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
link.rb
lib/noah/models/link.rb
+1
-1
links.rb
lib/noah/routes/links.rb
+12
-4
No files found.
lib/noah/models/link.rb
View file @
bc9007be
...
@@ -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
...
...
lib/noah/routes/links.rb
View file @
bc9007be
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment