Commit 8d8282b4 authored by Rémy Coutable's avatar Rémy Coutable

Add a safeguard in User#set_projects_limit

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent ebba4914
......@@ -589,6 +589,11 @@ class User < ActiveRecord::Base
end
def set_projects_limit
# `User.select(:id)` raises
# `ActiveModel::MissingAttributeError: missing attribute: projects_limit`
# without this safeguard!
return unless self.has_attribute?(:projects_limit)
connection_default_value_defined = new_record? && !projects_limit_changed?
return unless self.projects_limit.nil? || connection_default_value_defined
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment