在我的 Rails 应用程序中,routes.rb
我有
match "show_fail" => "Posts#show_fail"
在posts_controller.rb
:
def create
...
return redirect_to show_fail_path, :title => @post.title
end
def show_fail
end
在show_fail.html.erb
:
Unsuccessful posting of post title <%= title %>
但我得到了一个错误undefined local variable or method 'title'
。为什么它不知道title
变量,我该如何修复它?