Skip to content

When no currency conversion record #2

@sbounmy

Description

@sbounmy
def create_payment(amount_in_cents)
  self.coin_payments.create!(reason: 'sale', price: amount_in_cents, coin_type: :btc)
end

raises NoMethodError (undefined method `price' for nil:NilClass):

Because we havent imported currency conversions bundle exec rake cryptocoin_payable:process_prices

In dev env it's fine but not in test where datas are deleted on each run.

  • rails g cryptocoin_payable:install should generate test/fixtures/cryptocoin_payable/currency_conversions.yml
  • error should be more explicit for dev (exception to run bundle exec rake cryptocoin_payable:process_prices )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions