Skip to content

Instantly share code, notes, and snippets.

@theachyutkadam
Created August 1, 2018 10:11
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 theachyutkadam/592ff13a4b389c5c3b7057e96d9538af to your computer and use it in GitHub Desktop.
Save theachyutkadam/592ff13a4b389c5c3b7057e96d9538af to your computer and use it in GitHub Desktop.
1) Product.where(payment_type: "borrow").update_all(product_name: 0)
2) Product.where(payment_type: "cash").update_all(product_name: 1)
3) Product.all.each do |product|
product.update(payment_type: product.price)
product.update(product_name: product.item_id)
end
4) Product.where(product_name "0").update_all(payment_type: "0")
5) product.update(product_name: product.item_id)
Product.where("Date(created_at) =?", "2018-07-25")
(show date vie record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment