debian-mirror-gitlab/lib/gitlab/database/read_only_relation.rb
2019-01-03 12:48:30 +05:30

16 lines
423 B
Ruby

module Gitlab
module Database
# Module that can be injected into a ActiveRecord::Relation to make it
# read-only.
module ReadOnlyRelation
[:delete, :delete_all, :update, :update_all].each do |method|
define_method(method) do |*args|
raise(
ActiveRecord::ReadOnlyRecord,
"This relation is marked as read-only"
)
end
end
end
end
end