rails

はてなみたいに /user_name/ ってやる routes

map.with_options( :path_prefix => '/:user_name', :requirements => { :user_name => /[a-z][0-9a-z_\-]{2,30}[0-9a-z]/i }, :name_prefix => 'user_', :namespace => 'user/' ) do |user| user.root :controller => 'index' end こんな感じで。

URL末尾のスラッシュ / でアクションを変える

Rails 1.2.5 /hello で HelloController#index、/hello/ で HellController#slash を呼びたいが、routes.rb に ActionController::Routing::Routes.draw do |map| map.connect 'hello/', :controller => 'hello', :action => 'slash' map.connect 'hello', :…