{"author_url":"https://blog.hatena.ne.jp/ayaketan/","height":"190","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fayaketan.hatenablog.com%2Fentry%2F2014%2F04%2F02%2F180058\" title=\"Rails4 scope\u3067\u306e\u4e26\u3073\u9806\u6307\u5b9a - ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18","published":"2014-04-02 18:00:58","version":"1.0","author_name":"ayaketan","width":"100%","provider_name":"Hatena Blog","blog_url":"https://ayaketan.hatenablog.com/","type":"rich","provider_url":"https://hatena.blog","url":"https://ayaketan.hatenablog.com/entry/2014/04/02/180058","description":"scope\u3067\u4e26\u3073\u9806\u3092\u6607\u9806\u3068\u964d\u9806\u306b\u6307\u5b9a\u3059\u308b\u65b9\u6cd5\u306e\u30e1\u30e2\u3002 \u4f8b\u3048\u3070\u3001score\u3067\u4e26\u3073\u9806\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u3001\u6607\u9806\u3068\u964d\u9806\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u6307\u5b9a\u3059\u308b\u3002 # \u6607\u9806 scope :order_score, -> { order(:score) } # \u964d\u9806 scope :order_score_desc, -> { order(score: :desc) } \u53c2\u8003\uff1a Rails 4 default scope - Stack Overflow Rails4 scope\u3067ActiveRecord\u3092\u7c21\u6f54\u306b - ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18","image_url":null,"title":"Rails4 scope\u3067\u306e\u4e26\u3073\u9806\u6307\u5b9a","categories":["Ruby"]}