だいたいこれくらい動いちゃうと
満足して実装したい衝動が消えちゃう。。。
https://github.com/quek/info.read-eval-print.active-record
(establish-connection)
(defrecord prefecture ()
()
(:has-many :facilities))
(defrecord facility ()
()
(:belongs-to :prefecture)
(:has-many :experiences :as :experiencable))
(defrecord experience ()
()
(:belongs-to :experiencable :polymorphic t))
(let ((facilities (with-ar (facility)
(where "name like ?" "%水族館")
(where :publish 1)
(order :name)
(get-list))))
(values
(mapcar #'name-of facilities)
(name-of (prefecture-of (car facilities)))))
(facilities-of (with-ar (prefecture)
(where "id = 1")
(get-first)))
(experiences-of (with-ar (facility)
(get-first)))
(experiencable-of (with-ar (experience)
(get-first)))
(with-ar (facility)
(joins :prefecture)
(where :prefectures.name "鳥取県")
(get-list))
0 件のコメント:
コメントを投稿