0
我該如何使用資源和寧靜的協議來改進這段代碼?Rails restful資源而不是GET URL路徑
def render_with_hashtags_of_question(text)
text.gsub(TAG_REGEX){
|word| link_to word, "https://stackoverflow.com/questions/hashtag/#{word.mb_chars.downcase.delete('#')}"
}.html_safe
end
路線:
get '/questions/hashtag/:name', to: 'questions#hashtags'
非常感謝提前,夥計們!
這是有點不清楚你問。你想達到什麼目的? – Iceman
好吧,我嘗試過在'路線中找到'resources:questions do:hashtag,只有:[:index] end',並且根據'render_with_hashtags_of_question(text)'方法的變化:)我應該怎麼做這些修改? :) –
問題是一個真正的資源還是一個命名空間? – soupdog