Skip to content

Commit

Permalink
save parent when forking
Browse files Browse the repository at this point in the history
  • Loading branch information
jfontan committed Nov 21, 2011
1 parent b890016 commit 175cc56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/assets/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ function save() {

if(am_i_owner())
loc=window.location.href;
else {
data["parent"]=window.location.pathname;
}

$.post(loc,
JSON.stringify(data),
Expand Down
5 changes: 5 additions & 0 deletions server/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ def save_version(code_id, code)
:user => code_data['user']
}

if code_data['parent']
m=code_data['parent'].match(%r{^/(\d+)(/.*)?})
data[:parent] = m[1].to_i if m
end

CODE.insert(data)

save_version(counter, body)
Expand Down

0 comments on commit 175cc56

Please sign in to comment.