所以我制作了一个启动页面,并为每个帖子设置了一个重定向。但它搞砸了应用程序。当我得到下面的代码时,该应用程序不会保存用户提交的电子邮件地址。(当我注释掉重定向代码时,一切正常。)
class ApplicationController < ActionController::Base
  protect_from_forgery
  include SessionsHelper
   before_filter(:except => :splash) do
     redirect_to root_path
   end
 end
这是控制器。它基于 Railscast #124。所以对于启动页面,没有用户登录,这意味着邀请保存后,它应该保存并闪烁“谢谢,我们准备好时会通知”。但是当上面的过滤器就位时,它只是重新渲染“新”。
class InvitationsController < ApplicationController
  def new
    @invitation = Invitation.new
  end
  def create
    @invitation = Invitation.new(params[:invitation])
    @invitation.sender = current_user
    if @invitation.save
      if signed_in?
        UserMailer.invitation(@invitation).deliver
        flash[:notice] = "Thank you, invitation sent."
        redirect_to hunts_path      
      else
        flash[:notice] = "Thank you, we will notify when we are ready."
        redirect_to root_path  
      end
    else
      render :action => 'new'
    end
  end
end
任何想法我做错了什么?