Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Search - "needs rescue"
		- 
				    					
					
					I wrote a database migration to add a column to a table and populated that column upon record creation.
But the code is so freaking convoluted that it took me four days of clawing my eyes out to manage this.
BUT IT'S FINALLY DONE.
FREAKING YAY.
Why so long, you ask? Just how convoluted could this possibly be? Follow my lead ~
There's an API to create a gift. (Possibly more; I have no bloody clue.)
I needed the mobile dev contractor to tell me which APIs he uses because there are lots of unused ones, and no reasoning to their naming, nor comments telling me what they do.
This API takes the supplied gift params, cherry-picks a few bits of useful data out (by passing both hashes by reference to several methods), replaces a couple of them with lookups / class instances (more pass-by-reference nonsense). After all of this, it logs the resulting (and very different) mess, and happily declares it the original supplied params. Utterly useless for basically everything, and so very wrong.
It then uses this data to call GiftSale#create, which returns an instance of GiftSale (that's actually a Gift; more on that soon).
GiftSale inherits from Gift, and redefines three of its methods.
GiftSale#create performs a lot of validations / data massaging, some by reference, some not. It uses `super` to call Gift#create which actually maps to the constructor Gift#initialize.
Gift#initialize calls Gift#pre_init (passing the data by reference again), which does nothing and returns null. But remember: GiftSale inherits from Gift, meaning GiftSale#pre_init supersedes Gift#pre_init, so that one is called instead. GiftSale#pre_init returns a Stripe charge object upon success, or a Gift (and a log entry containing '500 Internal') upon failure. But this is irrelevant because the return value is never actually used. Pass by reference, remember? I didn't.
We're now back at Gift#initialize, Rails finally creates a Gift object using the args modified [mostly] in-place by all of the above.
Another step back and we're at GiftSale#create again. This method returns either the shiny new Gift object or an error string (???), and the API logic branches on its type. For further confusion: not all of the method's returns are explicit, and those implicit return values are nested three levels deep. (In Ruby, a method will return the last executed line's return value automatically, allowing e.g. `def add(a,b); a+b; end`)
So, to summarize: GiftSale#create jumps back and forth between Gift five times before finally creating a Gift instance, and each jump further modifies the supplied params in-place.
Also. There are no rescue/catch blocks, meaning any issue with any of the above results in a 500. (A real 500, not a fake 500 like last time. A real 500, with tragic consequences.)
If you're having trouble following the above... yep! That's why it took FOUR FREAKING DAYS! I had no tests, no documentation, no already-built way of testing the API, and no idea what data to send it. especially considering it requires data from Stripe. It also requires an active session token + user data, and I likewise had no login API tests, documentation, logging, no idea how to create a user ... fucking hell, it's a mess.)
Also, and quite confusingly:
There's a class for GiftSale, but there's no table for it.
Gift and GiftSale are completely interchangeable except for their #create methods.
So, why does GiftSale exist?
I have no bloody idea.
All it seems to do is make everything far more complicated than it needs to be.
Anyway. My total commit?
Six lines.
IN FOUR FUCKING DAYS!
AHSKJGHALSKHGLKAHDSGJKASGH.7 - 
				    					
					
					Wow so much hate for WordPress. Le me to the rescue 💀
Yes WP is bloated and crappy and full of security issues etc etc. Agreed. That doesn't mean it is useless though.
It is alright to use for someone who is not really good with web, someone who just needs a blog, someone who just needs a home page, about page and contact form with a possibility of updating photo and text once or two times a month.
It is not suitable for e-commerce nor lots of transactions/forms involving websites.
As long as you know what kind of horse/vehicle you are on, you won't end up in the dirt.4 - 
				    					
					
					Hi guys
Can we still install and use php 5.2 or php 5.3?
Got an old website that needs rescue
Coz of the depricated mysql functions
Much appreciated
Cheers5 - 
				    					
					
					Anyone else who can't comment on github?
Also was I had to try my pushes severally over the weekend(Not the fun kind).
Is github okay? - 
				    					
					
					HEV-Rescue Hybrid Battery Repair & EV Charging: Reliable Hybrid Car Service in San Diego and Trusted Hybrid Battery Shop in the Inland Empire
At HEV-Rescue Hybrid Battery Repair & EV Charging, we are dedicated to providing expert hybrid vehicle services for customers in San Diego and the Inland Empire. Whether you’re looking for a reliable hybrid car service in San Diego or searching for a hybrid battery shop in the Inland Empire, we are here to provide you with the best hybrid vehicle care and battery solutions. Located at 3235 Production Ave, Oceanside, CA 92058, we serve all of Southern California with high-quality services designed to keep your hybrid vehicle running at its best.
Why Choose HEV-Rescue for Hybrid Car Service in San Diego?
San Diego is a vibrant city with many eco-conscious drivers choosing hybrid vehicles to reduce emissions and save on fuel costs. However, like all vehicles, hybrids require regular maintenance and occasional repairs to ensure they operate efficiently and reliably. At HEV-Rescue, we offer specialized hybrid car service in San Diego, providing everything from battery diagnostics to performance checks for hybrid cars of all makes and models.
Our team of expert technicians has extensive experience working with hybrid systems, and we use the latest tools and technology to ensure your vehicle stays in optimal condition. From routine maintenance to more complex repairs, we offer a wide range of hybrid car services, including:
Hybrid Battery Diagnostics and Repair: If your vehicle is showing signs of battery issues such as reduced fuel efficiency or poor acceleration, we can diagnose and repair the battery to restore its performance.
Hybrid System Inspections: We perform detailed inspections of your hybrid car’s electric and combustion systems, ensuring both components are functioning as intended.
Routine Hybrid Car Maintenance: Regular maintenance is crucial to keeping your hybrid in top shape. We offer oil changes, tire rotations, brake servicing, and more to ensure long-lasting performance.
Choosing HEV-Rescue for your hybrid car service in San Diego means you are getting experienced technicians who specialize in hybrid technology and are committed to providing excellent customer care.
Hybrid Battery Shop in the Inland Empire
If you are in the Inland Empire and need expert hybrid battery care, HEV-Rescue is the hybrid battery shop you can trust. We specialize in hybrid battery repair, replacement, and reconditioning, offering high-quality service to keep your hybrid vehicle performing at its peak. Whether your battery is showing signs of wear or needs a complete replacement, we are here to help.
At our hybrid battery shop in the Inland Empire, we offer a range of services to meet all your hybrid battery needs:
Hybrid Battery Diagnostics and Repair: If your hybrid battery is showing signs of failure, our team will run diagnostics to identify the issue and provide efficient repair solutions.
Hybrid Battery Replacement: If your hybrid battery is beyond repair, we offer high-quality replacement batteries at competitive prices, ensuring your vehicle operates at its best.
Hybrid Battery Reconditioning: In many cases, we can restore your hybrid battery to near-new condition with our battery reconditioning services. This is a cost-effective option for extending the life of your battery without the expense of a full replacement.
Our hybrid battery shop in the Inland Empire is equipped with the latest technology and tools to ensure top-quality repairs and services. We work with a variety of hybrid car models, ensuring that we can meet your specific needs no matter the make or model of your vehicle.
Why Choose HEV-Rescue?
Experienced Technicians: Our team has extensive experience working with hybrid and electric vehicles, making us experts in hybrid car services and battery repairs.
Comprehensive Services: From hybrid car service in San Diego to hybrid battery shop solutions in the Inland Empire, we offer a full range of services to meet your needs.7 - 
				    					
					
					Rapid Tyre Rescue: Expert Tyre Assistance When You Need It the Most
At Rapid Tyre Rescue, we understand the frustration of dealing with a tyre blowout or a flat tyre at the most inconvenient times. Whether you’re on the side of the road, in your driveway, or stuck at work, we offer a full range of services to get you back on the road in no time. Serving Slough and the surrounding areas, we provide reliable, fast, and efficient tyre blowout assistance, flat tyre repair service, mobile tyre replacement, and mobile tyre repair services.
Tyre Blowout Assistance: Fast Response When You’re Stranded
A tyre blowout can happen at the most unexpected moments, often leaving you stranded and unsure of what to do next. Fortunately, Rapid Tyre Rescue offers tyre blowout assistance at any hour of the day or night. Our team is available to quickly respond and help you safely manage the situation. With our mobile units and professional technicians, we’ll come to your location and provide you with expert assistance, ensuring you're back on the road safely and as quickly as possible.
Flat Tyre Repair Service: Quick and Professional
If you’re facing the inconvenience of a flat tyre, Rapid Tyre Rescue has got you covered. Our flat tyre repair service is designed to save you time and hassle. Whether you’re at home, work, or on the road, our mobile service will come to your location and repair the tyre on the spot. We carry a variety of tools and equipment to handle punctures and other common flat tyre issues. In cases where a repair isn't possible, we can offer a swift tyre replacement to get you moving again.
Mobile Tyre Replacement: On-the-Spot Solutions
Don’t want to deal with the hassle of driving to a garage for a tyre replacement? With our mobile tyre replacement service, we bring the tyre shop to you! Whether you’re stuck at home, in a parking lot, or on the side of the road, Rapid Tyre Rescue can replace your tyres without you having to leave your location. We carry a wide selection of tyres in various sizes and brands to suit your vehicle's needs. Our team will arrive fully equipped to complete the job quickly and efficiently, so you can get back on your journey without delay.
Mobile Tyre Repair: Fast Solutions at Your Doorstep
Dealing with tyre damage when you're not near a garage can be incredibly frustrating. But with our mobile tyre repair service, we take the stress out of the situation. Our skilled technicians can assess the damage to your tyre and provide effective repairs right at your location. Whether it’s a simple puncture or a more complex issue, we’ll bring the tools and expertise to handle it all. Plus, if the tyre is beyond repair, we can replace it on the spot with minimal disruption to your day.
Why Choose Rapid Tyre Rescue?
Convenience: Our mobile tyre services mean you don’t have to go to a garage – we come to you!
Expert Technicians: All of our team members are highly trained and experienced in handling tyre blowouts, flat tyres, and other issues.
Speedy Service: We understand that time is of the essence. That’s why we aim to respond quickly and get you back on the road fast.
Affordable: We offer competitive rates for all of our services, ensuring that you get the best value without compromising on quality.
24/7 Availability: Our services are available around the clock, so you can rely on us for assistance, no matter the time.
Get in Touch with Rapid Tyre Rescue
When you need tyre blowout assistance, flat tyre repair service, mobile tyre replacement, or mobile tyre repair, don’t hesitate to reach out to Rapid Tyre Rescue. We’re committed to providing you with fast, reliable, and professional service. You can contact us at +44 7482 742906 or visit our business address at 94 Farnham Rd, Slough SL1 3FQ, United Kingdom. Let us help you get back on the road quickly and safely!11 
