rsl/stringex — pull request #153 by rwz (2014-03-10 23:35:22+00:00)
Title: Black list of slugs

The typical stringex use case example with Rails involves model scaffolding that uses generated url slug instead of id. However this doesn't prevent user from creating urls that are gonna overlap with default rails routing.

Consider this setup
```ruby
# config/routes.rb
resources :posts

# app/models/post.rb
class Post < AR::Base
acts_as_url :title
def to_param
url
end
end

# app/controllers/posts_controller.rb
class PostsController < ApplicationController
# standard crud stuff here
def create
@post = Post.new(post_params)
if @post.save
redirect_to @post, notice: "post created"
else
render :new
end
end
end
```

Say someone wants to create a post with title "New". That'll effectively generate url as "new" and the whole post path would become "/posts/new" which will take you to the new post form, not to the post itself.

I think acts-as-url component of stringex should support some kind of stop-list of url slugs (could be ["new"] by default) it needs to avoid and a policy to substitute them with something meaningful. For example, "new" slug could become "new-post".