forked from saurabh/personal-journal
fix deletes in journal paper
This commit is contained in:
parent
70064bde29
commit
adea371161
|
@ -2,9 +2,10 @@ class Admin::JournalPapersController < OrbitMemberController
|
|||
include Admin::JournalPapersHelper
|
||||
layout "member_plugin"
|
||||
|
||||
before_action :set_journal_paper, only: [:show, :edit , :update, :destroy]
|
||||
before_action :set_journal_paper, only: [:show, :edit , :update]
|
||||
before_action :get_plugins, only: [:index, :writing_journal_setting, :new, :create, :edit, :update]
|
||||
before_action :set_types, only: [:writing_journal_setting, :new, :edit, :create, :update]
|
||||
before_action :find_journal_paper, only: [:destroy]
|
||||
|
||||
def index
|
||||
@writing_journals = JournalPaper.all
|
||||
|
@ -179,6 +180,10 @@ class Admin::JournalPapersController < OrbitMemberController
|
|||
@journal_paper = JournalPaper.find_by(uid: uid)
|
||||
end
|
||||
|
||||
def find_journal_paper
|
||||
@journal_paper = JournalPaper.find_by(id: params[:id])
|
||||
end
|
||||
|
||||
def journal_paper_attributes
|
||||
params.require(:journal_paper).permit! rescue nil
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ class JournalPapersController < ApplicationController
|
|||
"issue_no" => journal_paper.issue_no,
|
||||
"form_to_start" => journal_paper.form_to_start,
|
||||
"form_to_end" => journal_paper.form_to_end,
|
||||
"language" => t(journal_paper.language),
|
||||
"language" => journal_paper.language,
|
||||
"total_pages" => journal_paper.total_pages,
|
||||
"keywords" => journal_paper.keywords,
|
||||
"abstract" => journal_paper.abstract,
|
||||
|
|
|
@ -33,7 +33,7 @@ class JournalPaper
|
|||
has_many :journal_paper_files, autosave: true, dependent: :destroy
|
||||
accepts_nested_attributes_for :journal_paper_files
|
||||
|
||||
has_and_belongs_to_many :journal_paper_authors
|
||||
has_and_belongs_to_many :journal_paper_authors, dependent: :destroy
|
||||
accepts_nested_attributes_for :journal_paper_authors
|
||||
|
||||
has_and_belongs_to_many :journal_paper_author_types
|
||||
|
|
|
@ -8,5 +8,5 @@ class JournalPaperFile
|
|||
field :should_destroy, type: Boolean
|
||||
|
||||
mount_uploader :journal_file, AssetUploader
|
||||
belongs_to :journal_paper
|
||||
belongs_to :journal_paper, dependent: :destroy
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue