Using the correct url_for method in a Rails engine spec

前端 未结 4 1357
自闭症患者
自闭症患者 2020-12-15 21:27

I have a request spec in a Rails engine. The view that is rendered calls a route and passes in a hash, i.e. projects_path(:scope => \"user\"). A route like t

4条回答
  •  庸人自扰
    2020-12-15 22:06

    For me, the issue was caused by passing a hash as the second argument of a link_to line.

    <%= link_to('click me', {one: params[:one], two: params[:two]}) %>
    

    wrapping the hash in the actual path method for the page fixed the issue

    <%= link_to('click me', actual_path({one: params[:one], two: params[:two]})) %>
    

提交回复
热议问题