Skip to content

Commit

Permalink
Improve compatibility with Rails 5 & Redmine 4 - Do not use alias_met…
Browse files Browse the repository at this point in the history
…hod_chain
  • Loading branch information
nanego committed Mar 13, 2019
1 parent 485a47e commit 7e7670a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/patches/issue_custom_field_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module IssueCustomFieldPatch
included do
unloadable

def validate_custom_field_with_skip_regexp_valid
validate_custom_field_without_skip_regexp_valid
def validate_custom_field
super

invalid_message = l('activerecord.errors.messages.invalid')
if errors[:regexp].include?(invalid_message) && field_format == SerialNumberField::Format::NAME
Expand All @@ -21,12 +21,11 @@ def validate_custom_field_with_skip_regexp_valid
end
end

alias_method_chain :validate_custom_field, :skip_regexp_valid
end

end
end

SerialNumberField::IssueCustomFieldPatch.tap do |mod|
IssueCustomField.send :include, mod unless IssueCustomField.include?(mod)
IssueCustomField.send :prepend, mod unless IssueCustomField.include?(mod)
end

0 comments on commit 7e7670a

Please sign in to comment.