タケユー・ウェブ日報

Ruby on Rails や Flutter といったWeb・モバイルアプリ技術を武器にお客様のビジネス立ち上げを支援する、タケユー・ウェブ株式会社の技術ブログです。

2020-04-07から1日間の記事一覧

特定のActionで読み込み専用のレプリカを使う

ActiveRecord::Base.connected_to で包む class PostsController < ApplicationController around_action :set_reading_role, only: %i[index show] def index @posts = Post.all # :reading end def show @post = Post.find(params[:id]) @post.touch # => …