Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## routes.rb
- match "blog" => "blog#index"
- match "blog/:year/:month" => "blog#by_date", :constraints => {:year => /\d{4}/, :month => /\d{2}/}, :as => 'blog'
- match "blog/:tag" => "blog#by_tag", :as => 'blog'
- ##a view:
- = link_to "Foo", blog_path(:tag => "bar")
- ##it tries to route it to the second route, realizes the bound params don't match what the route specifies, and shits
- ##bricks. I would prefer if it either: a) realized the error of its ways and routed it properly; or b) said 'fuck it' and
- ##linked to /blog?tag=bar. It doesn't.
- ##Problem solved with :as => "by_tag". Then in the view I do as_tag_path(:tag => 'bar') instead. The URLs stay the same.
- ##This is a minor annoyance, but understandable
Add Comment
Please, Sign In to add comment