Murajun's Style

Top > Rails

Rails

2014-09-07

Railsで子テーブルのスコープを使うヘ(^o^)ノ

Rails Ruby

例えばこんな感じのモデル class User < ActiveRecord::Base has_many :posts end class Post < ActiveRecord::Base belongs_to :user scope :published, -> { where(published: true) } end 公開中のPostを取得する場合はこんな感じですよね? $ Post.publi…

Hatena Bookmark - Railsで子テーブルのスコープを使うヘ(^o^)ノ
Railsで子テーブルのスコープを使うヘ(^o^)ノ
Prev page
Profile
id:murajun1978 id:murajun1978
Subscribed unsubscribe Subscribe Subscribe
Follow @murajun1978
Search
Recent Entries
  • docker runを使って、Next.jsやGatsbyなんかをgenerateしてみるヘ(^o^)ノ
  • 僕の月曜日ルーティーン
  • 俺的WH-1000XM4レビュー
  • Railsのconcernにはロジックを書くのはやめよう
  • 俺的、最強のデスクトップ環境を作ってみたヘ(^o^)ノ
Category
  • Node.js (3)
  • Docker (3)
  • Rails (31)
  • Next.js (4)
  • goober (1)
  • tailwindcss (1)
  • GraphQL (1)
  • Apollo Server (1)
  • Ruby (22)
  • 現場で役立つシステム設計の原則 (1)
  • Software design (1)
  • Event (1)
  • JavaScript (4)
  • 登山 (1)
  • GitHub (2)
  • Visual Studio Code (1)
  • TypeScript (1)
  • Tmux (1)
  • Jest (1)
  • Gitbook (1)
  • Git (3)
  • Gem (5)
  • Vim (2)
  • RSpec (4)
  • Shinosakarb (3)
  • FactoryGirl (1)
  • VPS (1)
  • CoreOS (1)
Murajun's Style Murajun's Style

Powered by Hatena Blog | ブログを報告する

Star added

Quote saved.

Login to quote this blog

Failed to save quote. Please try again later.

You cannot quote because this article is private.

Subscribed unsubscribe Subscribe Subscribe