Use safe navigation instead of rescue nil
This commit is contained in:
@@ -3,11 +3,11 @@ module Measurable
|
|||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
def title_max_length
|
def title_max_length
|
||||||
@title_max_length ||= (columns.find { |c| c.name == "title" }.limit rescue nil) || 80
|
@title_max_length ||= (columns.find { |c| c.name == "title" }&.limit) || 80
|
||||||
end
|
end
|
||||||
|
|
||||||
def responsible_name_max_length
|
def responsible_name_max_length
|
||||||
@responsible_name_max_length ||= (columns.find { |c| c.name == "responsible_name" }.limit rescue nil) || 60
|
@responsible_name_max_length ||= (columns.find { |c| c.name == "responsible_name" }&.limit) || 60
|
||||||
end
|
end
|
||||||
|
|
||||||
def question_max_length
|
def question_max_length
|
||||||
|
|||||||
Reference in New Issue
Block a user