You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
更新情報: 2013/11/19: 初版公開 2021/01/08: 訳文見直し、追記 こんにちは、hachi8833です。今回は、自分が知りたかった、Active Recordモデルのリファクタリングに関する記事を翻訳いたしました。1年前の記事なのでRails 3が前提ですが、Rails 4以降でも基本的には変わらないと思います。リンクは可能なものについては日本語のものに置き換えています。 なお、ここでご紹介したオブジェクトは、app以下にそれぞれ以下のようにフォルダを追加してそこに配置します。 注記: 以下は使われそうなフォルダを列挙しただけであり、実際にはこの一部しか使いません。 Value Object Service Object Form Object Query Object View Object Policy Object Decorator ⚓ 肥大化したActive
(この記事は Ruby Advent Calendar jp:2010の 15 日目です。前日は tomohiro68 さんでした。) Arelとは Arelの概要については@a_matsudaさんのgihyoの記事を参照してください。 http://gihyo.jp/dev/serial/01/ruby/0043 はじめに 扱うRDBはSQlite3です。 例として以下のようなスキーマを持ったテーブルを取り扱い、進めていきます。 class CreateBooks < ActiveRecord::Migration def self.up create_table :books do |t| t.string :name t.string :category t.timestamps end end def self.down drop_table :books end end 基本的な
I'm doing some statics calculation in my product. A user has performed a number of operations, let's say posted comments. I want to be able to show them how many comments they've posted per week for the past month, or per month for the past year. Is there any way with activerecord to group this way? Is my best best to simply do this manually - to iterate over the records summing based on my own cr
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く