Skip to content

Instantly share code, notes, and snippets.

@vannio
Last active November 15, 2018 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vannio/5320fa62c9cc9c9b6e9d43c3a499dd50 to your computer and use it in GitHub Desktop.
Save vannio/5320fa62c9cc9c9b6e9d43c3a499dd50 to your computer and use it in GitHub Desktop.
Useful Eagle snippets
def mark_order(number, state = 'shipped')
o = Spree::Order.find_by(number: number)
o.update_attribute('shipment_state', state)
s = o.shipments.first
s.update_attribute('state', state)
s.update_attribute('shipped_at', s.expected_shipping_date) if state == 'shipped'
end
def mark_customisation(number, state = 'prepared')
o = Spree::Order.find_by(number: number)
o.line_items.each do |li|
c = li.customisation
c.update_attribute('state', state)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment