我有以下路线输出:
http://localhost:3001/chefs/peter (shows the chef profile **based on username**)
http://localhost:3001/chefs/edit (can edit their profile if logged)
如何阻止用户创建已具有修改等操作名称的用户名?
答案 0 :(得分:1)
我认为应该有多个解决方案,但使用排除验证应该有效。
validates :name, :exclusion => { :in => %w(edit show) }