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