Rails Is Built for AI

(rubyonrails.org)

14 points | by cdnsteve 6 hours ago ago

9 comments

  • andrewstuart 5 hours ago

    AI needs typing.

    Also AI does not benefit from abstractions such as ORMs - you are far better to have your AI write SQL.

    That goes for all abstractions including CSS JavaScript and everything else Rails has wrapped.

    Golang with raw SQL CSS JavaScript works really well cause it avoids many abstractions and affordances that Rails makes to humanize programming.

    • adam_arthur 2 hours ago

      Abstractions allow for better business logic density and fewer tokens per concept/area of code. This is still very meaningful for today's LLMs.

      Strictly speaking, if codebase A is doing the same thing as codebase B, but is 5-10x the LoC, you will be limited in how broadly you can effectively prompt the LLM. Queries will take longer, more technical debt+anti-patterns will creep in.

      Anyone building large projects from scratch with LLMs will see plainly that they start to perform worse and slow down meaningfully as the codebase grows if you aren't pruning and compartmentalizing the code as you go.

      Agree that abstractions which have a large performance cost are net-net not so worthwhile anymore. But many abstractions can be done with minimal performance hit (e.g. Rust)

    • bbaron63 5 hours ago

      I don't see why using AI with ORMs has no benefits. The AI could be useful in analyzing the SQL that is generated by the ORM to advise and surface potential performance bottlenecks. The AI could advise whether using lazy or eager strategies should be used.

    • earthnail 4 hours ago

      Rails no longer wraps CSS or JS.

      And it can benefit from ORMs, because it means less tokens.

      The biggest advantage of Rails is convention over configuration. Standardisation means AI is trained on lots of standardised codebases. So that still pays in AI land. The question to me is whether that’s such a big upside that it gives a real edge. Not sure on that; Python has way more code overall.

    • lucisferre 5 hours ago

      AI needs typing? Why? That seems counterintuitive to me.

      I agree on ORMs, but that would apply with or without AI for me personally. ORMs and ActiveRecord are an obvious and well documented anti-pattern at this point in time.

      • zbentley 4 hours ago

        AI can benefit significantly from type checking. This provides a minimal-setup-required feedback loop that it can use to address errors. User defined types are also a greppable “what do I need to look at in this codebase to implement feature X?” signal, and serve as a means of hinting what you want the AI to change without writing code (stub out some functions and/or refer to new nonexistent types rather than writing prose for some parts of your spec).

    • gabosarmiento 5 hours ago

      [dead]

  • chrisjj 4 hours ago

    > The One Person Framework

    AI ate your hyphen?

  • rdevilla 5 hours ago

    [dead]