Rails 3 Problem with Routes Constraint
I'm trying to make it so that I can have a urls like this: /events /events/sunday # => The day is optional However, it doesn't seem to be working even though I know it is getting called. It is at the bottom of my routes file. match '/:post(/:day_filter)' => 'posts#index', :as => post_day_filter, :constraints => DayFilter.new class DayFilter def initialize @days = %w[all today tomorrow sunday monday tuesday wednesday thursday friday saturday] end def matches?(request) return @days.include?(request.params[:day_filter]) if request.params[:day_filter] true end end Here is my rake routes output: