transferred Code Ocean from original repository to GitHub
This commit is contained in:
14
app/models/error.rb
Normal file
14
app/models/error.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class Error < ActiveRecord::Base
|
||||
belongs_to :execution_environment
|
||||
|
||||
scope :for_execution_environment, ->(execution_environment) do
|
||||
Error.find_by_sql("SELECT MAX(created_at) AS created_at, MAX(id) AS id, message, COUNT(*) AS count FROM errors WHERE #{sanitize_sql_hash_for_conditions(execution_environment_id: execution_environment.id)} GROUP BY message ORDER BY count DESC")
|
||||
end
|
||||
|
||||
validates :execution_environment_id, presence: true
|
||||
validates :message, presence: true
|
||||
|
||||
def self.nested_resource?
|
||||
true
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user