Skip to content

Instantly share code, notes, and snippets.

@shu0115
Created July 23, 2012 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shu0115/3162352 to your computer and use it in GitHub Desktop.
Save shu0115/3162352 to your computer and use it in GitHub Desktop.

基本的なルーティング設定

Rublio::Application.routes.draw do
  match "/auth/:provider/callback" => "sessions#callback"
  match "/auth/failure" => "sessions#failure"
  match "/logout" => "sessions#destroy", :as => :logout

  root to: 'top#index'

  match ':controller(/:action(/:id))(.:format)'
end

※基本的に上記のルーティング以外は追加しない

現状のRESTfulに対する疑問点

  • RESTfulにする事によってユーザにはどんなメリットがあるのか

  • Railsを採用する事によって開発効率/開発速度が上がり、より早くユーザにプロダクトやサービスを届けられる、より早くバグ修正を行う事が出来るみたいな

  • コントローラやアクションの追加に付随して、プログラマ自身がroutes.rbに設定を追加しなければならないのが面倒、かつCoCの原則からも外れているように感じる

  • routes.rbは1ファイルでルーティングを設定しているため、メソッド分割やファイル分割も出来なく、何十行、数百行などに渡るルーティング設定の優先順位を考えたり、ルーティング周りの処理をトレースし辛くなる

  • 〜_pathのような書き方も、可読性が悪く、直感的にルーティングをイメージし辛いように感じる

  • RESTfulに準拠したところで、多少URLが綺麗になる程度のメリットしか無いように感じる、コスト対効果が釣り合っていない(現状ではコストの方が遥かに大きいように見える)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment