Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/models/gera/exchange_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ class ExchangeRate < ApplicationRecord
validates :commission, numericality: { greater_than_or_equal_to: MIN_COMISSION }
validates :calculator_type, inclusion: { in: CALCULATOR_TYPES }, allow_nil: true, if: -> { self.class.column_names.include?('calculator_type') }

delegate :rate, :currency_rate, to: :direction_rate
delegate :rate, to: :direction_rate

# Get currency_rate directly from repository to avoid circular dependency
# when creating DirectionRate (direction_rate -> exchange_rate.currency_rate -> direction_rate)
def currency_rate
@currency_rate ||= Universe.currency_rates_repository.find_currency_rate_by_pair(currency_pair)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ой это н правильно )

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

так может выдутая совершенной другой currency_rate. было все верно. В чем именно проблема-то?

end

delegate :auto_comission_by_reserve, :comission_by_base_rate, :auto_rate_by_base_from,
:auto_rate_by_base_to, :auto_rate_by_reserve_from, :auto_rate_by_reserve_to,
Expand Down
Loading