How to set fitetype depends on current directory?
===

I`m using Vim I would like to set my filetype like below

    autocmd BufNewFile,BufRead *_controller.rb set ft=rails syntax=ruby

but depends on current file directory example if I open ```/code/project/app/model/somefile.rb``` I would like to set ```filetype``` as ```model```