4 ms·
> and perhaps most importantly there's a "right" way to do just about everything your web application will ever need to do A good chunk of chaos in Rails apps
by sodapopcan 2y ago
> and perhaps most importantly there's a "right" way to do just about everything your web application will ever need to do
A good chunk of chaos in Rails apps is caused by people who either insist they know better than the out-of-the-box solutions, or they “just prefer it my way.”
- cpursley 2y agoThe biggest issues in Rails come from trying to do things with the ORM that should be done in the database.
- mehal 2y agoStrongly agree to this. Rails developers for some reason just abandoning any work in database and tend to work with data in ruby env
- cpursley 2y agoYep, I'm a big fan of building views in postgres and just hitting those with the ORM. I don't even use the join syntax in my ORM (Ecto) - if I need a join, I use a view.
- arcanemachiner 2y agoInteresting. Does Ecto have any syntax that supports this behavior? Or do you just use raw SQL for this?
- cpursley 2y agoYou just treat a view the same way as a table with Ecto.
- PittleyDunkin 2y agoEven as a bonafide activerecord hater, this sentiment doesn't make much sense to me. The ORM is like 70% of what makes rails fast to develop with, which is the entire reason to use rails in the first place. Everything from routes to rendering to form validation is tightly integrated around object lifecycles. If you get rid of that there's not much benefit to use rails (or in fact ruby) at all.
- randomdata 2y agoWouldn't you say you are a bonafide activerecord hater because of those same issues? I don't expect you hate it because your lost love interest shares the AR initials. ActiveRecord can both offer fast development and create issues (especially those that only come to bite you later). It exists in a multi-faceted environment. Tradeoffs, as always.
- PittleyDunkin 2y agoYes, I think it generally makes rails much more difficult to scale than it has to be, much more difficult to test, and more difficult to verify changes are "safe". I certainly agree with the commentary on tradeoffs, though, and I stand by my comment that AR is a big part of why Rails is such a massive success.
- randomdata 2y ago> I stand by my comment that AR is a big part of why Rails is such a massive success. I think most would agree. It is the "doesn't make much sense" part that we're discussing, though. How does it not make sense when you seem to have the same opinion of it? It seems, as an onlooker, that it makes perfect sense to you.
- PittleyDunkin 2y ago> How does it not make sense when you seem to have the same opinion of it? Well, what remains of Rails or of ActiveRecord once you remove the part that's done outside the database? It just seemed like a very shallow view of what rails is.
- rco8786 2y agoI think historically that's probably right, but something that has gotten much better with time. Previously, ActiveRecord gave newer programmers a legible, fluent interface to the database in a language they already knew. So instead of learning SQL, we abused the heck out of AR. I think that the industry, and rails itself, has matured since then and I see a lot less of this nowadays.
- deleted 2y ago[deleted]
- PittleyDunkin 2y agothe extensive use of method_missing doesn't help either.
- semiquaver 2y agoCan you point to any substantial places in rails where method_missing is actually used? The only place I’m aware of is dynamic finder methods like find_by_foo, which IIRC were removed years ago. Most of the more magical ORM stuff is implemented using boot-time metaprogramming things like define_method.
- PittleyDunkin 2y agoI'll take your word for it—I'm currently blessed by working outside of the rails ecosystem so my knowledge is likely out of date. EDIT: I'm not bothered by this, but this is a very odd comment to downvote. What on earth is so offensive or distracting about saying someone else is likely more knowledgable than you are? Very confusing.
- rco8786 2y agoThat's been gone since Rails 4 or 5 (we're on 8 now)