Rails: Preserving GET query string parameters in link_to

前端 未结 8 2184
忘掉有多难
忘掉有多难 2020-12-02 15:22

I have a typical search facility in my app which returns a list of results that can be paginated, sorted, viewed with a different records_per_page value, etc. Each of these

8条回答
  •  盖世英雄少女心
    2020-12-02 16:03

    You can just throw elements of the params hash at link_to. Like

    link_to "some_other_link", "/search", :page => params[:page]
    

提交回复
热议问题