home.social

#activerecord — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #activerecord, aggregated by home.social.

  1. New TIL post on ActiveRecord Custom Types

    In developing bracket-lab, I needed a 1-indexed bit field of 63 bits, stored as an unsigned 63-bit value in an int64 column.

    ActiveRecord’s custom types made this clean.

    haruska.com/til/activerecord-c

    #ruby #rails #activerecord

  2. It happens you need some field in the database to not contain an empty string, but to be NULL. For example, a unique index has been added to this field, meaning there can only be one record with an empty string. However, if the field has a NULL value, it is unique and there can be multiple such records.

    #Ruby #Rails #ActiveRecord #Normalization #NULL #Empty #UNIQUE

  3. At Kaigi on Rails 2025, Rails Committer Yasuo Honda walked through:

    • Protocol 3.2 & extended cancel keys
    • Why pg ≥ 1.6 matters
    • UNLOGGED partition removal
    • pg_stat_statements improvements
    • Virtual generated columns (now default in PG18)
    • Rails 8.1 adapter support

    This is a great example of ecosystem coordination:
    PostgreSQL core → pg gem → Rails adapter → production apps.

    Full technical breakdown 👇

    rubystacknews.com/2026/02/11/r

    #Rails #PostgreSQL #Ruby #ActiveRecord #OpenSource

  4. At Kaigi on Rails 2025, Rails Committer Yasuo Honda walked through:

    • Protocol 3.2 & extended cancel keys
    • Why pg ≥ 1.6 matters
    • UNLOGGED partition removal
    • pg_stat_statements improvements
    • Virtual generated columns (now default in PG18)
    • Rails 8.1 adapter support

    This is a great example of ecosystem coordination:
    PostgreSQL core → pg gem → Rails adapter → production apps.

    Full technical breakdown 👇

    rubystacknews.com/2026/02/11/r

    #Rails #PostgreSQL #Ruby #ActiveRecord #OpenSource

  5. At Kaigi on Rails 2025, Rails Committer Yasuo Honda walked through:

    • Protocol 3.2 & extended cancel keys
    • Why pg ≥ 1.6 matters
    • UNLOGGED partition removal
    • pg_stat_statements improvements
    • Virtual generated columns (now default in PG18)
    • Rails 8.1 adapter support

    This is a great example of ecosystem coordination:
    PostgreSQL core → pg gem → Rails adapter → production apps.

    Full technical breakdown 👇

    rubystacknews.com/2026/02/11/r

    #Rails #PostgreSQL #Ruby #ActiveRecord #OpenSource

  6. At Kaigi on Rails 2025, Rails Committer Yasuo Honda walked through:

    • Protocol 3.2 & extended cancel keys
    • Why pg ≥ 1.6 matters
    • UNLOGGED partition removal
    • pg_stat_statements improvements
    • Virtual generated columns (now default in PG18)
    • Rails 8.1 adapter support

    This is a great example of ecosystem coordination:
    PostgreSQL core → pg gem → Rails adapter → production apps.

    Full technical breakdown 👇

    rubystacknews.com/2026/02/11/r

    #Rails #PostgreSQL #Ruby #ActiveRecord #OpenSource

  7. At Kaigi on Rails 2025, Rails Committer Yasuo Honda walked through:

    • Protocol 3.2 & extended cancel keys
    • Why pg ≥ 1.6 matters
    • UNLOGGED partition removal
    • pg_stat_statements improvements
    • Virtual generated columns (now default in PG18)
    • Rails 8.1 adapter support

    This is a great example of ecosystem coordination:
    PostgreSQL core → pg gem → Rails adapter → production apps.

    Full technical breakdown 👇

    rubystacknews.com/2026/02/11/r

    #Rails #PostgreSQL #Ruby #ActiveRecord #OpenSource

  8. e.g. Yesterday I Learned about #ActiveRecord's overloading of the #Ruby "shovel" ("<<") operator, and a couple of weeks ago I started a foray into #Rails YAML serialisation, which seems to have changed quite a bit between versions, leading to inconsistently-formatted data in the database, and the exciting prospect of writing a data migration that runs raw SQL queries 😵

  9. e.g. Yesterday I Learned about #ActiveRecord's overloading of the #Ruby "shovel" ("<<") operator, and a couple of weeks ago I started a foray into #Rails YAML serialisation, which seems to have changed quite a bit between versions, leading to inconsistently-formatted data in the database, and the exciting prospect of writing a data migration that runs raw SQL queries 😵

  10. e.g. Yesterday I Learned about #ActiveRecord's overloading of the #Ruby "shovel" ("<<") operator, and a couple of weeks ago I started a foray into #Rails YAML serialisation, which seems to have changed quite a bit between versions, leading to inconsistently-formatted data in the database, and the exciting prospect of writing a data migration that runs raw SQL queries 😵

  11. ActiveRecord: опасная магия

    В Ruby‑разработке ActiveRecord давно стал стандартом: он интуитивно понятен, встроен в Rails и позволяет быстро проводить CRUD‑операции. По мере роста проекта его «удобство» нередко начинает оборачиваться скрытыми проблемами.

    habr.com/ru/articles/970042/

    #ruby #rubyonrails #sql #activerecord #ошибки_и_грабли #n+1 #orm

  12. ActiveRecord: опасная магия

    В Ruby‑разработке ActiveRecord давно стал стандартом: он интуитивно понятен, встроен в Rails и позволяет быстро проводить CRUD‑операции. По мере роста проекта его «удобство» нередко начинает оборачиваться скрытыми проблемами.

    habr.com/ru/articles/970042/

    #ruby #rubyonrails #sql #activerecord #ошибки_и_грабли #n+1 #orm

  13. ActiveRecord: опасная магия

    В Ruby‑разработке ActiveRecord давно стал стандартом: он интуитивно понятен, встроен в Rails и позволяет быстро проводить CRUD‑операции. По мере роста проекта его «удобство» нередко начинает оборачиваться скрытыми проблемами.

    habr.com/ru/articles/970042/

    #ruby #rubyonrails #sql #activerecord #ошибки_и_грабли #n+1 #orm

  14. ActiveRecord: опасная магия

    В Ruby‑разработке ActiveRecord давно стал стандартом: он интуитивно понятен, встроен в Rails и позволяет быстро проводить CRUD‑операции. По мере роста проекта его «удобство» нередко начинает оборачиваться скрытыми проблемами.

    habr.com/ru/articles/970042/

    #ruby #rubyonrails #sql #activerecord #ошибки_и_грабли #n+1 #orm

  15. Einmal ins Rabbit Hole von RubyonRails und ActiveRecord abtauchen und zurück?
    Viel Spaß!
    ... und keine Klagen, wenn ihr länger drin geblieben seid als geplant 😆
    youtube.com/watch?v=B4gEyuEQaBM
    #rubyonrails #activerecord #deepdive

  16. Einmal ins Rabbit Hole von RubyonRails und ActiveRecord abtauchen und zurück?
    Viel Spaß!
    ... und keine Klagen, wenn ihr länger drin geblieben seid als geplant 😆
    youtube.com/watch?v=B4gEyuEQaBM
    #rubyonrails #activerecord #deepdive

  17. Einmal ins Rabbit Hole von RubyonRails und ActiveRecord abtauchen und zurück?
    Viel Spaß!
    ... und keine Klagen, wenn ihr länger drin geblieben seid als geplant 😆
    youtube.com/watch?v=B4gEyuEQaBM
    #rubyonrails #activerecord #deepdive

  18. Einmal ins Rabbit Hole von RubyonRails und ActiveRecord abtauchen und zurück?
    Viel Spaß!
    ... und keine Klagen, wenn ihr länger drin geblieben seid als geplant 😆
    youtube.com/watch?v=B4gEyuEQaBM
    #rubyonrails #activerecord #deepdive

  19. Коммуникация по RESTful API: синхронизируем данные с маркетплейсами

    В статье разбирается код на Ruby и в Ruby on Rails, в частности, на примере задачи по разработке web-сервиса синхронизации данных с внешними источниками. Погружение в программное решение начинается с разбора бизнес-задачи. Через освещение реальных API с маркетплейсов OZON и Яндекс.Маркет обосновываются способы принятия архитектурных решений и способы оптимизации кода. Эта статья также является авторской попыткой раскрыть принцы SOLID при реализации логики реального бэкенд приложения по переработке структурированных данных в условиях эксплуатации стороннего REST API.

    habr.com/ru/articles/796169/

    #ruby_on_rails #restful_api #postgresql #sidekiq #redis #solid #development #logger #ruby #activerecord

  20. JRuby's activerecord-jdbc-adapter doesn't yet support ActiveRecord 8. How should a gem which depends on ActiveRecord try to best support both CRuby and JRuby?
    rubygems.org/gems/activerecord

    #activerecord #jruby

  21. Suppose you want a test in #Rails #ActiveRecord that says "make sure this scope has applied".

    How about using `#annotate` in the scope definition, then testing the generated SQL for the presence of the annotation text?

  22. Suppose you want a test in #Rails #ActiveRecord that says "make sure this scope has applied".

    How about using `#annotate` in the scope definition, then testing the generated SQL for the presence of the annotation text?

  23. Suppose you want a test in #Rails #ActiveRecord that says "make sure this scope has applied".

    How about using `#annotate` in the scope definition, then testing the generated SQL for the presence of the annotation text?

  24. Suppose you want a test in #Rails #ActiveRecord that says "make sure this scope has applied".

    How about using `#annotate` in the scope definition, then testing the generated SQL for the presence of the annotation text?

  25. Suppose you want a test in #Rails #ActiveRecord that says "make sure this scope has applied".

    How about using `#annotate` in the scope definition, then testing the generated SQL for the presence of the annotation text?

  26. #Rails #ActiveRecord is very keen on binding variables. Perhaps too keen.

    If you have a polymorphic association `batchable` then you get SQL like `batchable_type = $1`, but you'd need a lot of unique types for the benefits of bind variables to outweight to loss of accurate cardinality estimation, surely.

    And implementing `#exists?` with a bind variable as `LIMIT $1` seems quirky.

  27. ⏰ Just one hour away, our June online meetup is starting ⏰
    Join us today at 12pm Eastern for An ActiveRecord Rewrite: the Story Behind the Attributes API talk from Tess Griffin! Find us and the meetup link on discord: discord.gg/KfBeRSjK?event=1384

    #online #meetup #ruby #rails #activerecord

  28. Wide Models and Active Record custom validation contexts, by @bensheldon

    island94.org/2025/04/wide-mode

    > This post is a brief description of a pattern I use a lot using when building features in Ruby on Rails apps and that I think needed a name:

    > Wide Models have many attributes (columns in the database) that are updated in multiple places in the application, but not always all at once i.e. different forms will update different subsets of attributes on the same model.

    #ruby #ActiveRecord

  29. How fast can an ActiveRecord SQL query run?, by Fritz Meissner
    thoughtbot.com/blog/how-fast-c

    > Your database monitoring (perhaps Amazon RDS performance insights, Skylight, or the #Postgres pg_stat_activity view) is telling you that one particular query in your Rails app is causing heavy load. Unfortunately, it already seems pretty fast. What are the odds that you can get it to run any faster?

    #ruby #SQL #ActiveRecord

  30. I know #SQLite3 supports #SQL comments in newer versions with the right flags, but `rails g` for #ActiveRecord ďoesn’t seem to support them except in #PostgreSQL or #MySQL / #MariaDB. Is there a workaround?

  31. Made a gem out of an earlier proof-of-concept: github.com/henrik/activemodel-

    This lets you do things like

    ``` ruby
    with_conditions(if: :feature_x_is_on?) do
    validate :free_plans_must_have_x, if: :free_plan?
    end
    ```

    where the conditions merge intuitively, unlike `with_options`.

    #RubyOnRails #ActiveRecord #ActiveModel

  32. Am I the only one that dont like other ORMs than Rails Active Record? I mean, FastAPI's SQLAlchemy, SQLModel in combination with pydantic as well as Symfonys Doctrine feels a little bit pain in the a** when it comes to complex relations. Active Record just feels smooth compared to the other ones...

    #rubyonrails #activerecord #fastapi #sqlalchemy #sqlmodel #pydantic #doctrine #symfony #python #orm #database

  33. Eradicating N+1s: The Two-phase Data Load and Render Pattern in Go, by @brandur

    > Using a two-phase data load and render pattern to prevent N+1 queries in a generalized way. Especially useful in Go, but applicable in any language.

    #golang #ActiveRecord #ruby

  34. Today I used generated columns in SQL for the first time. These are computed columns that are updated on write and can be indexed. They work with PostgreSQL, MySQL and even SQLite.

    Adding a migration via the Sequel gem was pretty straight forward. ActiveRecord has also built-in support for generated columns.

    Here is a great overview about this: medium.com/the-table-sql-and-d

    #sql #ruby #sequel #activerecord

  35. How do you safely close the sqlite3 database file when using ActiveRecord in a Sinatra app? Doling a Ctrl^C results in the sqlite3 lock files being left behind.
    #sinatra #activerecord

  36. What do people prefer for ensuring that ActiveRecord connections get freed (in a Sinatra app)?
    #activerecord #sidekiq #sinatra

  37. Why do I keep getting this error with ActiveRecord in this Sinatra+Sidekiq app:

    could not obtain a connection from the pool within 5.000 seconds (waited 5.000 seconds); all pooled connections were in use

    I'm already passing `pool: 4` to `ActiveRecord::Base.establish_connect(...)` to set the connection pool size, which is what Google/StackOverflow recommends, but it's still randomly occurring.
    #activerecord

  38. Another day, another #ActiveRecord feature proposal from our team. 😆

    This one would allow a middleware-esque design for altering the behavior/configuration of DB transactions.

    discuss.rubyonrails.org/t/prop

    #Rails

  39. Excellent article from @bensheldon about taking advantage of prepared statements in Rails:

    Rails Active Record: Will it bind?

    island94.org/2024/03/rails-act

    #ruby #rails #activerecord