mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
fixes migration error
This commit is contained in:
parent
c801e7b7e3
commit
060da59bbb
1 changed files with 12 additions and 4 deletions
|
@ -1,11 +1,10 @@
|
|||
require 'graphviz'
|
||||
|
||||
class Experiment < ActiveRecord::Base
|
||||
include ArchivableModel, SearchableModel
|
||||
|
||||
belongs_to :project, inverse_of: :experiments
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id, class_name: 'User'
|
||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id,
|
||||
class_name: 'User'
|
||||
belongs_to :archived_by, foreign_key: :archived_by_id, class_name: 'User'
|
||||
belongs_to :restored_by, foreign_key: :restored_by_id, class_name: 'User'
|
||||
|
||||
|
@ -15,7 +14,8 @@ class Experiment < ActiveRecord::Base
|
|||
|
||||
has_attached_file :workflowimg
|
||||
validates_attachment :workflowimg,
|
||||
content_type: { content_type: ["image/png"] }
|
||||
content_type: { content_type: ['image/png'] },
|
||||
if: :workflowimg_check
|
||||
|
||||
validates :name,
|
||||
presence: true,
|
||||
|
@ -204,6 +204,8 @@ class Experiment < ActiveRecord::Base
|
|||
# This method generate the workflow image and saves it as
|
||||
# experiment attachment
|
||||
def generate_workflow_img
|
||||
require 'graphviz'
|
||||
|
||||
graph = GraphViz.new(:G,
|
||||
type: :digraph,
|
||||
use: :neato)
|
||||
|
@ -611,4 +613,10 @@ class Experiment < ActiveRecord::Base
|
|||
my_module_groups.reload
|
||||
true
|
||||
end
|
||||
|
||||
def workflowimg_check
|
||||
workflowimg_content_type
|
||||
rescue
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue