You are integrating with a 3rd party application that contains statistics on the most popular baby names for a given year. You have both high-level stats and per-name information you’d like to display. It’d be nice if you could write the code like this: class NamesController < ApplicationController def index @names = Names::Client.all_names end def show @name = Names::Client.find_name(params[:name
Wrap your paginated collections in Enumerable goodness The thing with paginated data is we can't get it all at once. Let's say we're using the Trello API. There are a number of Trello endpoints that return paginated data sets, such as boards, lists, cards, and actions (like comments, copies, moves, etc). If we're querying for Trello cards marked as completed each month since last January, for exam
DBなどの検索による絞り込みとpaginationの組み合わせ例です。 Controller_Item のaction_list() は絞り込みをせず表示しています。 同じくController_Itemのaction_search() は"category"というパラメータをGETパラメータで渡し、絞り込み表示を行っています。 ポイントはpaginationのuri_segmentパラメータをpageで処理しているところと、 pagination_urlに検索パラメータ(GET)を追加しているところです。 ■Controller(action_listメソッド) <?php namespace Item; class Controller_Item extends \Controller_Base { private $_classname = 'item'; private $_per
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く