From 55dbfd8c4eb4802a0bbbf977aca1b140a0cb914e Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 29 Nov 2012 16:48:07 +0800 Subject: [PATCH] fixed journal update method --- app/controllers/desktop/journal_pages_controller.rb | 13 ++++++------- app/views/desktop/journal_p.html.erb | 2 +- app/views/devise/registrations/edit.html.erb | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/controllers/desktop/journal_pages_controller.rb b/app/controllers/desktop/journal_pages_controller.rb index 69334a5b7..21121e57e 100644 --- a/app/controllers/desktop/journal_pages_controller.rb +++ b/app/controllers/desktop/journal_pages_controller.rb @@ -54,13 +54,12 @@ class Desktop::JournalPagesController < ApplicationController def update params[:writing_journal][:update_user_id] = current_user.id @writing_journal= WritingJournal.find(params[:id]) - respond_to do |format| - if @writing_journal.update_attributes(params[:writing_journal]) - render json: {success: true, msg: "Paper successfully saved!"}.to_json - else - error_msg = @writing_journal.errors.full_messages.join("
") - render json: {success: false, msg: error_msg}.to_json - end + + if @writing_journal.update_attributes(params[:writing_journal]) + render json: {success: true, msg: "Paper successfully saved!"}.to_json + else + error_msg = @writing_journal.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json end end diff --git a/app/views/desktop/journal_p.html.erb b/app/views/desktop/journal_p.html.erb index b27c35601..e6b455a0c 100644 --- a/app/views/desktop/journal_p.html.erb +++ b/app/views/desktop/journal_p.html.erb @@ -16,7 +16,7 @@
  • List
  • Add/Edit
  • Journals
  • -
  • Co-Authors
  • +
  • Co-Authors
  • Tags & Keywords
  • Analysis
  • Import
  • diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 5f2720754..4d74f8d8a 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -23,4 +23,4 @@

    Unhappy? <%#= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.

    <%#= link_to "Back", :back %> - --> \ No newline at end of file + -->