Rails

Vite Rubyを使ってVueアプリケーションを動かしてみた

高速と噂のBetaがとれたViteで、BackendがRuby(Rack)なVueアプリケーションを開発できたら、最高かもしれない。 ということで調べてみると、Vite Rubyなるものがあったので動かしてみました。 参考 Getting Started | Vite Ruby 手順 事前準備 Node.jsのバー…

Sidekiqをsystemdに登録する

公式サンプルがありました。ありがたい。 sidekiq/sidekiq.service at master · mperham/sidekiq · GitHub 以下、上記の冒頭部分を引用。 # # This file tells systemd how to run Sidekiq as a 24/7 long-running daemon. # # Customize this file based on…

composed_ofでhas_manyぽくする

ActiveRecordなオブジェクトとPOROなオブジェクトを、1対多で関連付けたかった。 環境 Rails 6.0.2 Ruby 2.6.5 方法 POROでエンティティクラスを定義する POROでエンティティの集約クラスを定義する ActiveRecord継承クラスと集約クラスをcomposed_ofする サ…