Rails No route matches {:controller=>“devise/products”}

前端 未结 2 1037
再見小時候
再見小時候 2020-12-18 04:16

I get the below error on my rails application when I try to login or register (I\'m using the Devise GEM for logins).

Routing Error
No route matches {:contro         


        
2条回答
  •  暖寄归人
    2020-12-18 04:51

    Way late to the party, but this was my solution. Simply prefix the controller as absolute with "/". A little long and ugly, but returns link for a controller/action or a route passed. I use it to build menus driven from sql table.

      # dynamic link_to
      def menu_link(params, html_options=nil)
        if params[:controller].present?
          link_to params[:display], {controller: "/#{params[:controller]}", action: params[:resource]}, default_navigation_options(html_options)
        elsif params[:route].present?
          link_to params[:display], params[:route], default_navigation_options(html_options)
        end
      end
    

提交回复
热议问题