{"blog_title":"\u30c4\u30e6\u30c0\u30af\u306e\u8089\u5897\u3057\u306eRuby on Rails\u306e\u521d\u5fc3\u8005\u3067","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fjiikko.hatenadiary.org%2Fentry%2F20140309%2F1394375964\" title=\"rails4.1\u306edefalut_scope - \u30c4\u30e6\u30c0\u30af\u306e\u8089\u5897\u3057\u306eRuby on Rails\u306e\u521d\u5fc3\u8005\u3067\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","blog_url":"https://jiikko.hatenadiary.org/","author_name":"jiikko","title":"rails4.1\u306edefalut_scope","url":"https://jiikko.hatenadiary.org/entry/20140309/1394375964","provider_name":"Hatena Blog","published":"2014-03-09 23:39:24","author_url":"https://blog.hatena.ne.jp/jiikko/","image_url":null,"height":"190","description":"\u4ed5\u69d8\u304c\u5909\u308f\u308a\u3001default_scope\u306e\u5185\u5bb9\u304c\u4e0a\u66f8\u304d\u3055\u308c\u305a\u306b\u30c1\u30a7\u30a4\u30f3\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002 4.1\u3088\u308a\u524d class User < ActiveRecord::Base default_scope { where state: 'pending' } scope :active, -> { where state: 'active' } scope :inactive, -> { where state: 'inactive' } end User.all # SELECT \"users\".* FROM \"users\" WHERE \"users\".\"state\" = 'pending' Use\u2026","type":"rich","provider_url":"https://hatena.blog","categories":["Rails"],"version":"1.0"}