05 Aug '13, 7am

Ruby - RailsでJSON APIを定義するならRABLが便利! by @yuch_i on @Qiita

object false child(@item => :result) do attribute :id, :name, :memo, :bought_at, :location_name, :price, :user, :likes, :comments, :tags node :photo_url do |item| item.photo.url end child :user do attribute :id, :name node :photo_url do |user| user.photo.url end end child(:tags) do attribute :name end child(:likes) do attribute :user_id end child(:comments) do attribute :user, :body, :created_at child(:user) do attribute :id node :photo_url do |user| user.photo.url end end end end

Full article: http://qiita.com/yuch_i/items/f6b04e2875f432f8f806

Tweets