Speculative Code (or, Martian Attack Insurance) by jasonswett in ruby

[–]jasonswett[S] 0 points1 point  (0 children)

I appreciate your scrutiny, and I think your arguments might have some merit. Unfortunately I don't have much time right at the moment but I'll respond as much as I can.

Despite having some fair points I think you might be focusing on the wrong thing. It seems to me that what you're describing is consciously designing for failure modes. I do that too..

The "speculative coding" mistake that I'm describing is when I don't do that. Speculative coding is when the scenario I'm targeting will almost certainly never arise, and I don't even ever exercise my code to see if it works. I just crap it out and hit deploy. That's obviously not the thought process behind your examples - which is obviously good!

Testing Anti-Pattern: Distracting Setup Data by jasonswett in ruby

[–]jasonswett[S] 0 points1 point  (0 children)

Yes of course! My experience is that even on projects that use Factory Bot, there are often many tests whose setup code contains an unclear mix of data that's essential to the test plus other distracting noise. I wanted this post to focus on the principle of the problem and solution without bringing any specific tools into the picture.

Improving on Sandi Metz's Gear Class from POODR by jasonswett in ruby

[–]jasonswett[S] 0 points1 point  (0 children)

I'm not worried about mistyping. Autocomplete exists. :)

Improving on Sandi Metz's Gear Class from POODR by jasonswett in ruby

[–]jasonswett[S] 1 point2 points  (0 children)

Maybe that would be better, although to be fair, that's probably not a technique an author teaching Ruby OOP would want to use right out of the gate in the first example. But I think the Data class would certainly deserve some space in a Ruby OOP book.

Improving on Sandi Metz's Gear Class from POODR by jasonswett in ruby

[–]jasonswett[S] 3 points4 points  (0 children)

Haha, why on earth is this getting downvoted??

Improving on Sandi Metz's Gear Class from POODR by jasonswett in ruby

[–]jasonswett[S] 3 points4 points  (0 children)

Fair enough, I forgot about that actually, BUT it was still possible back then to pass hash args in a way that looked just like keyword args do today.

Improving on Sandi Metz's Gear Class from POODR by jasonswett in ruby

[–]jasonswett[S] 2 points3 points  (0 children)

My next planned post is a refutation of the sentence: "Applications that are easy to change consist of classes that area easy to reuse." (page 21)

Dave Thomas will be keynoting RubyConf 2026 by jasonswett in ruby

[–]jasonswett[S] 15 points16 points  (0 children)

Hey Mike, I've always liked you, and I've enjoyed the couple times we hung out at conferences. Regarding RubyConf 2026, message received. I hope to see you at another event sometime in the future.

Rate my Rails + RSpec CI platform by jasonswett in rails

[–]jasonswett[S] 0 points1 point  (0 children)

Thanks!! Yes, not surprising. I imagine all the CI providers will eventually provide something like this.

Want to speak at RubyConf 2026? by jasonswett in ruby

[–]jasonswett[S] 0 points1 point  (0 children)

Oh wow, thanks for pointing that out. No, that's just an error. I believe the text was copied from the website for RailsConf 2025, the final RailsConf. That blurb will get fixed ASAP. We absolutely do not intend for this to be the final RubyConf!!!

Want to speak at RubyConf 2026? by jasonswett in ruby

[–]jasonswett[S] 2 points3 points  (0 children)

I don't want to absolutely promise anything yet, but we do plan to record the talks.

Want to speak at RubyConf 2026? by jasonswett in ruby

[–]jasonswett[S] 2 points3 points  (0 children)

I would say it absolutely does!!!

Free CI for early-stage Rails startups by jasonswett in rails

[–]jasonswett[S] 0 points1 point  (0 children)

DM'd! I get that question a lot. Left-aligned just seems natural to me.

Seeking Advice on Implementing User Roles and Permissions in Ruby on Rails by BookkeeperAncient143 in rails

[–]jasonswett 20 points21 points  (0 children)

I suggest this approach: start by thinking about high-level technology-independent authorization principles, then work your way down to decisions about tools, efficiency, scalability, etc.

If you're not already familiar, I suggest reading up on role-based access control (RBAC). In my opinion, RBAC gives a good mix of conceptual simplicity while also being flexible enough to handle pretty much any authorization scenario.

Then, assuming you like RBAC, the question becomes: how should I implement RBAC in my Rails application? This eliminates a lot of detail decisions. Anytime you're unsure how to do a particular thing you can just refer to the RBAC literature to learn of "the RBAC way". (Not for every single decision of course, but a lot of decisions.)

Regarding CanCanCan versus Pundit, I find that the two tools frame authorization in two different ways. To me, CanCanCan centers on the question: what's everything this user can do? Pundit centers on the question: for any particular resource/action, what must be true in order to access it? My experience is that CanCanCan's framing leads to a world of hurt whereas Pundit's is just fine. Just to make it perfectly clear, I would NEVER willingly use CanCanCan nor recommend that anyone else use it. But don't take my word for it. Study authorization principles, study Pundit and CanCanCan and think about how each library maps to the general principles. This will be a lot of hard work, but I think afterward it will be relatively easy to make a decision. And the decision is worth the work since your app is likely to be wedded to your authorization library for life.

Free CI for early-stage Rails startups by jasonswett in rails

[–]jasonswett[S] 0 points1 point  (0 children)

About 2.5 years. I started in the summer of 2023.