Class: EthBlock
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- EthBlock
- Defined in:
- lib/facetq/models/eth_block.rb
Overview
ApplicationRecord
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.max_processed_block_number ⇒ Object
41 42 43 |
# File 'lib/facetq/models/eth_block.rb', line 41 def self.max_processed_block_number EthBlock.processed.maximum(:block_number).to_i end |
Instance Method Details
#as_json(options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/facetq/models/eth_block.rb', line 47 def as_json( = {}) super(.merge( only: [ :block_number, :timestamp, :blockhash, :parent_blockhash, :imported_at, :processing_state, :transaction_count, ] )).tap do |json| if association(:transaction_receipts).loaded? json[:transaction_receipts] = transaction_receipts.map(&:as_json) end end.with_indifferent_access end |