I suggest the following approach
Add this route at the end of the routes.rb
.
get "/:slug", to: 'brands#index'
And you can then find the brand based on the params[:slug]
value.
def index
@brand = Brand.find_by(name: params[:slug])
# extra code
end
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…