タグ

rubyに関するokitaのブックマーク (2)

  • Ruby geocoderがすごい - もぎゃろぐ

    住所を緯度経度に直したり、緯度経度から住所を求めたりする操作をgeocodingと言って、Google Maps APIを使うとまあたいていのことはできる。 ロケタッチAPIとか、Yahoo!ジオコーダAPIという手もある。 それはともかく、そのへんをパチパチ叩くコードを書いていて、「こんなのもうとっくに誰かが書いてんじゃないかなー」と思ってぐぐってみたらなんかすごいのが出てきた。 Ruby Geocoder 住所と緯度経度の相互変換はもちろん、距離や範囲の扱い、Google以外のAPIへの対応、キャッシュ処理など、「実装しようかなー。でもめんどくさいよね」とか思って先送りしていたような機能がほとんど全部実装されている。 住所の取得 require 'geocoder' # 日語ロケールに設定 Geocoder.configure( :language => :ja, :units =>

    okita
    okita 2015/12/07
  • Buckblog: Skinny Controller, Fat Model

    18 October 2006 — The "Fat Controller" anti-pattern is shown and dissected, and the reader is taken through the process of refactoring it into a more readable, maintainable, and testable solution — 5-minute read When first getting started with Rails, it is tempting to shove lots of logic in the view. I’ll admit that I was guilty of writing more than one template like the following during my Rails

  • 1