Exception: Upkeep::ActiveRecordQuery::OpaqueRelationError
- Inherits:
-
StandardError
- Object
- StandardError
- Upkeep::ActiveRecordQuery::OpaqueRelationError
- Defined in:
- lib/upkeep/active_record_query.rb
Instance Attribute Summary collapse
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
-
#sql ⇒ Object
readonly
Returns the value of attribute sql.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(relation, reasons:) ⇒ OpaqueRelationError
constructor
A new instance of OpaqueRelationError.
- #suggestions ⇒ Object
Constructor Details
#initialize(relation, reasons:) ⇒ OpaqueRelationError
Returns a new instance of OpaqueRelationError.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/upkeep/active_record_query.rb', line 12 def initialize(relation, reasons:) @model_name = relation.klass.name @table_name = relation.klass.table_name @sql = relation.to_sql @reasons = reasons super() rescue StandardError => error super("Upkeep could not analyze this Active Record relation: #{error.message}") end |
Instance Attribute Details
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
10 11 12 |
# File 'lib/upkeep/active_record_query.rb', line 10 def model_name @model_name end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
10 11 12 |
# File 'lib/upkeep/active_record_query.rb', line 10 def reasons @reasons end |
#sql ⇒ Object (readonly)
Returns the value of attribute sql.
10 11 12 |
# File 'lib/upkeep/active_record_query.rb', line 10 def sql @sql end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
10 11 12 |
# File 'lib/upkeep/active_record_query.rb', line 10 def table_name @table_name end |
Instance Method Details
#suggestions ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/upkeep/active_record_query.rb', line 23 def suggestions [ "Check that the relation emits valid SQL for the configured database adapter.", "Report unsupported SQL with the query, adapter, and SQLGlot version.", "Render this boundary outside Upkeep reactivity until the SQL is supported." ] end |