我得到了错误:RoutingError (No route matches [GET] "/new_invitation"):。
运行rake routes会产生:
...
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
...但是它在第3行,有什么想法吗?
编辑
invitations_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我尝试重命名控制器,模型和视图模板,但没有效果。有什么想法吗?
错误消息
Started GET "/new_invitation" for 127.0.0.1 at 2014-10-16 19:40:36 -0600
ActionController::RoutingError (No route matches [GET] "/new_invitation"):发布于 2014-10-17 03:40:00
试试这个(如果脚本在同一个控制器上的位置)
$('#DialogPop').bPopup({
loadUrl: '<%= url_for :action => 'new' %>',
modalClose: false
});或(推荐)
$('#DialogPop').bPopup({
loadUrl: '<%= new_invitation_path %>',
modalClose: false
});注意:如果视图中的自定义javascript或带有.js.erb扩展的javascript文件中的自定义javascript
https://stackoverflow.com/questions/26416575
复制相似问题