title: Rails 3 - controller Conditional?
body: <p>I have a controller that is:</p>
  
  <pre><code>def create
  .
  .
  @project = Project.find(params[:project]
  
  @Log = Logs.create(params[:action]).merge(:project_id =&gt; @project.id))
  ...
  end
  </code></pre>
  
  <p>The issue hereis that sometimes when DEF CREATE, I'll have a project and I want to record that. Other times I won't and that's perfectly fine, I still want to create the @Log</p>
  
  <p>What's the right way in Rails to handle this. I'll want to make sure: </p>
  
  <ul>
  <li>The first line @project doesn't error.</li>
  <li>Also that the @log doesn't error but inserts '' or NIL whatever is rails standard.</li>
  </ul>
  
  <p>Thank you</p>