mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
18 lines
441 B
Ruby
18 lines
441 B
Ruby
class DocumentsController < ApplicationController
|
|
def update
|
|
document = Document.find(params[:id])
|
|
|
|
unless document.user == current_user
|
|
redirect_to dashboard_path, notice: "You don't have permission to do that!"
|
|
return
|
|
end
|
|
|
|
document.update(document_params)
|
|
redirect_to notes_path, notice: "Your scratchpad has been saved!"
|
|
end
|
|
|
|
def document_params
|
|
params.require(:document).permit(:body)
|
|
end
|
|
end
|