Skip to content

Instantly share code, notes, and snippets.

@ksolvesnutra
ksolvesnutra / check_old_urls.rb
Created August 21, 2020 11:48
[issue#548] Script to update Products and Product Category related URLs in the content of various sections such as Products, Articles, Videos, Faqs, Studies Redirect-Pages, Sliding-Images, Content.
artical_arr = []
faq_arr = []
study_arr = []
video_arr = []
product_arr = []
trnsf_pg = []
sliding_img = []
cont_arr = []
Product.find_each do |prod|
@ksolvesnutra
ksolvesnutra / check_videos_old_urls.rb
Created July 3, 2020 12:58
[issue#549] Script to update Videos related URLs in the content of various sections such as Products, Articles, Videos, Faqs, Studies Redirect-Pages, Sliding-Images.
artical_arr = []
faq_arr = []
study_arr = []
video_arr = []
product_arr = []
trnsf_pg = []
sliding_img = []
Video.find_each do |vid|
@ksolvesnutra
ksolvesnutra / check_article_urls.rb
Last active June 30, 2020 11:40
[issue#550] Script to update Articles related URLs in the content of various sections such as Products, Articles, Videos, Faqs, Studies Redirect-Pages.
artic = []
fa = []
stud = []
vid = []
prod = []
trnsf_pg = []
Article.find_each do |art|
Article.where("
@ksolvesnutra
ksolvesnutra / update_tracker_products_as_per_hardy.rb
Last active April 24, 2020 10:25
[issue #493] Script to link Tracker Products with Hardy's Products and alter the active/inactive status of Tracker products as per active/inactive status of Hardy's products
den = Product.find_by(name: "Daily Essential Nutrients (360)")
tracker_den_obj = Wellness::HardyProduct.where('lower(name) = ?', 'daily essential nutrients').first
tracker_den_obj.update_attributes(name: "Daily Essential Nutrients (360)", product_id: den.id, active: den.active)
# =============================================================================================
Wellness::HardyProduct.where(product_id: nil).count
Product.count