Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug for gollum can not update no existing page #111

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/gikis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update

commit = { :name => current_user.login, :email => current_user.email, :message => params[:wiki][:change_desc]}

if @wiki.update_attributes(params[:wiki], commit)
if @wiki.update_attributes(@wiki, params[:wiki], commit)
redirect_to giki_path(@wiki.name)
else
render :edit
Expand Down
7 changes: 4 additions & 3 deletions app/models/wiki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ def self.find(name)
end
end

def update_attributes(hash,commit)
def update_attributes(wiki, hash,commit)
raw_data = hash[:raw_data]
name = hash[:name]
data = DATA.page(name)
DATA.update_page(data, name,:markdown, raw_data, commit )
page = DATA.page(wiki.name)
wiki.name = name
DATA.update_page(page, name,:markdown, raw_data, commit )
end

def save(commit)
Expand Down