mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-08 16:06:03 +08:00
Merge pull request #730 from Ducz0r/lm-sci-1427-fix
Fixes DEPRECATION WARNING-s for Rails 5.1.2 [SCI-1427]
This commit is contained in:
commit
738fc46080
5 changed files with 8 additions and 7 deletions
|
@ -8,7 +8,7 @@ class AssetTextDatum < ApplicationRecord
|
|||
after_save :update_ts_index
|
||||
|
||||
def update_ts_index
|
||||
if data_changed?
|
||||
if saved_change_to_data?
|
||||
sql = "UPDATE asset_text_data " +
|
||||
"SET data_vector = to_tsvector(data) " +
|
||||
"WHERE id = " + Integer(id).to_s
|
||||
|
|
|
@ -12,7 +12,8 @@ class MyModule < ApplicationRecord
|
|||
validates :description, length: { maximum: Constants::TEXT_MAX_LENGTH }
|
||||
validates :x, :y, :workflow_order, presence: true
|
||||
validates :experiment, presence: true
|
||||
validates :my_module_group, presence: true, if: "!my_module_group_id.nil?"
|
||||
validates :my_module_group, presence: true,
|
||||
if: proc { |mm| !mm.my_module_group_id.nil? }
|
||||
|
||||
belongs_to :created_by,
|
||||
foreign_key: 'created_by_id',
|
||||
|
|
|
@ -669,9 +669,9 @@ class Protocol < ApplicationRecord
|
|||
|
||||
def update_linked_children
|
||||
# Increment/decrement the parent's nr of linked children
|
||||
if self.parent_id_changed?
|
||||
if self.parent_id_was != nil
|
||||
p = Protocol.find_by_id(self.parent_id_was)
|
||||
if saved_change_to_parent_id?
|
||||
unless parent_id_before_last_save.nil?
|
||||
p = Protocol.find_by_id(parent_id_before_last_save)
|
||||
p.record_timestamps = false
|
||||
p.decrement!(:nr_of_linked_children)
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class Step < ApplicationRecord
|
|||
validates :position, presence: true
|
||||
validates :completed, inclusion: { in: [true, false] }
|
||||
validates :user, :protocol, presence: true
|
||||
validates :completed_on, presence: true, if: "completed?"
|
||||
validates :completed_on, presence: true, if: proc { |s| s.completed? }
|
||||
|
||||
belongs_to :user, inverse_of: :steps, optional: true
|
||||
belongs_to :last_modified_by,
|
||||
|
|
|
@ -120,7 +120,7 @@ class Table < ApplicationRecord
|
|||
end
|
||||
|
||||
def update_ts_index
|
||||
if contents_changed?
|
||||
if saved_change_to_contents?
|
||||
sql = "UPDATE tables " +
|
||||
"SET data_vector = " +
|
||||
"to_tsvector(substring(encode(contents::bytea, 'escape'), 9)) " +
|
||||
|
|
Loading…
Reference in a new issue