This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Refactor this! | |
def import(file, partner) | |
raise if filepath[-3..-1] != 'csv' | |
CSV.foreach(filepath, headers: true, header_converters: CSV::HeaderConverters[:symbol]) do |row| | |
order = Order.find_or_initialize_by(partner_order_number: row["order_number"]) | |
location = Location.find_by(location_number: row["location_number"]) | |
customer = Customer.find_by(email: customer_profile.customer_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given an amount like 57 cents | |
# return how many of each denomination needed to make that total | |
# these are the denominations: | |
# 1 cent, 5 cent, 10 cent, 25 cent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vehicle | |
end | |
class Car < Vehicle | |
end | |
class Bus < Vehicle | |
end | |
class Jeep < Vehicle |