Reputation: 817
I have
resources :articles
and in article.rb
def to_param
"#{id}-#{name.downcase.gsub(/\s+/, "_")}"
end
So the URL will be like
www.example.com/articles/1-Name-of-the-first-article
I am now trying to find a simple solution to always substitute "article" in the URL with "encyclopedia". So the path should be
www.example.com/encyclopedia/1-Name-of-the-first-article
Is there a simple solution?
Upvotes: 0
Views: 41