If Statement for nested attribute not working correctly on create action(Rails)
<p>Question is I have two models the first is called project and the second is status. Project accepts nested attr for my status model. That being said when I do an if statement in my project create action it seems like it isn't working. I dont get any errors and it doesnt send out my action mailer method. Any help would be greatly appreciated. </p>

<p>Here is my project model </p>

<pre><code>class Project &lt; ActiveRecord::Base

  has_many :status

  accepts_nested_attributes_for :status, :allow_destroy =&gt; true
end 
</code></pre>

<p>Here is my status model </p>

<pre><code>class Status &lt; ActiveRecord::Base
  belongs_to :project
end 
</code></pre>

<h1>My status model actually has a column called status which is what I am trying to check on the create action in my project controller bellow.</h1>

<p>Here is my project controller</p>

<pre><code>class ProjectController &lt; ApplicationController


  def create
    @project = Project.new(p_params)
    respond_to do |format|

      if @project.save
        #these if statements are the ones that aren't working.
        if @project.status == 'Production'
          ProjectMailer.alert_production(@project).deliver
        elsif @project.status == 'Design For Manufacturing'
          ProjectMailer.alert_dfm(@project).deliver
        elsif @project.status == 'Prototype'
          ProjectMailer.alert_prototype(@project).deliver
        elsif @project.status == 'Tooling'
          ProjectMailer.alert_tooling(@project).deliver
        elsif @project.status == 'Quality'
          ProjectMailer.alert_quality(@project).deliver
        end
        format.html { redirect_to project_index_path, :notice =&gt; 'Project successfully created.' }
        format.xml { render :xml =&gt; @project, :status =&gt; :created, :location =&gt; @project }
      end
    end
  end

  private

  def p_params
    params.require(:project).permit(:project_id, :in_visual, :planner, :part_num, :status, :customer, status_attributes: [:id, :a_d, :status, :note,
   :process,
   :sim_date, 
   :sim_reqs, :sim_def_quote, :tool_date, :tool_mat, :tool_o_source, :tool_insp, :tool_cust_paper, :tool_pro_ready, :pro_process, :pro_date])
  end
end
</code></pre>