Ruby on rails RoutingError(Rails中没有与[GET]匹配的路由

Ruby on rails RoutingError(Rails中没有与[GET]匹配的路由,ruby-on-rails,routes,Ruby On Rails,Routes,我收到错误:RoutingError没有与之匹配的路由[GET]/new\u邀请: 运行rake路由会产生: ... invitations GET /invitations(.:format) invitations#index POST /invitations(.:format) invitations#create new_invitation GET /invitati

我收到错误:RoutingError没有与之匹配的路由[GET]/new\u邀请:

运行rake路由会产生:

...
    invitations GET    /invitations(.:format)                invitations#index
                POST   /invitations(.:format)                invitations#create
 new_invitation GET    /invitations/new(.:format)            invitations#new
edit_invitation GET    /invitations/:id/edit(.:format)       invitations#edit
     invitation GET    /invitations/:id(.:format)            invitations#show
                PUT    /invitations/:id(.:format)            invitations#update
                DELETE /invitations/:id(.:format)            invitations#destroy
...
但是在第三行,有什么想法吗

编辑

U controller.rb包含

def new
  @invitation = Invitation.new (permitted_params.invitation)
end

def create
  @invitation = Invitation.new(permitted_params.invitation)
    if current_user
      @invitation.sender = current_user
      if @invitation.save
        UserMailer.invitation(@invitation, register_url(@invitation.token)).deliver
        flash[:notice] = "You have successfully sent the invitation."
        redirect_to styleguide_path
      else
        render :action => 'new'
      end
    else
     @invitation.sender = 0
     if @invitation.save
       UserMailer.invitation(@invitation, register_url(@invitation.token)).deliver
       flash[:notice] = "Your request for an invitation has been processed.  Please check your email for your invitation link."
       redirect_to root_path
     else
       render :action => 'new'
     end
    end

  end
我尝试过重命名控制器、模型和视图模板,但没有成功。有什么想法吗

错误消息


如果脚本的位置在同一控制器上,请尝试此操作

$('#DialogPop').bPopup({
  loadUrl: '<%= url_for :action => 'new' %>',
  modalClose: false
});
或推荐

$('#DialogPop').bPopup({
  loadUrl: '<%= new_invitation_path %>',
  modalClose: false
});
注意:如果视图中有自定义javascript,或者javascript文件中有.js.erb扩展名的自定义javascript


显示详细的错误消息..您想获得/investments/new,但获得了/new_investment。您单击了链接吗?能否显示链接?该链接通过自定义javascript调用加载表单的弹出生成器。相关js代码为:$'DialogPop'。bPopup{loadUrl:'/new_investment',modalClose:false};有效。只需将文件名更改为:filename.js.erb
$('#DialogPop').bPopup({
  loadUrl: '<%= new_invitation_path %>',
  modalClose: false
});