How to display photos on edit and file_field on new

My form partial is being used to create new, and also for editing.

<% form_for @deal, :html => { :multipart => true } do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :city_id %>
    <%= f.collection_select :city_id, City.find(:all), :id, :name,
{ :prompt => 'Select a city' }, {:class => 'foobar'} %>
  </p>
  <p>
    <%= f.label :title %><br />
    <%= f.text_field :title %>
  </p>
  <p>
    <%= f.label :description %><br />
    <%= f.text_area :description %>
  </p>
  <p>
    <%= f.label :price %><br />
    <%= f.text_field :price %>
  </p>
  <p>
    <%= f.label :value %><br />
    <%= f.text_field :value %>
  </p>
  <p>
    <%= f.label :discount %><br />
    <%= f.text_field :discount %>
  </p>
  <p>
    <%= f.label :savings %><br />
    <%= f.text_field :savings %>
  </p>
  <p>
    <%= f.label :goal %><br />
    <%= f.text_field :goal %>
  </p>
  <p>
    <%= f.label :countdown %><br />
    <%= f.text_field :countdown %>
  </p>
  <p>
    <%= f.label :purchased %><br />
    <%= f.text_field :purchased %>
  </p>

  <% f.fields_for :photos do |builder| %>
    <p class="fields">
      <%= builder.label :photo, "Photos" %><br />

      <% if !@deal.new_record? %>

        <%= image_tag :photo.url(:small) %>
      <% else %>
        <%= builder.file_field :photo %>
      <% end %>

      <br />

      <!--
      <%= builder.check_box :_destroy %>
      <%= f.label :destroy, "Remove photo" %>
      -->

      <%= builder.hidden_field :_destroy %>
      <%= link_to_function "remove", "remove_fields(this)" %>
    </p>
  <% end %>

  <p><%= link_to_add_fields "Add photos", f, :photos %></p>

  <% f.fields_for :features do |builder| %>
    <p class="fields">
      <%= builder.label :description, "Features" %><br />
      <%= builder.text_area :description, :rows => 3 %><br />

      <!--
      <%= builder.check_box :_destroy %>
      <%= f.label :destroy, "Remove description" %>
      -->

      <%= builder.hidden_field :_destroy %>
      <%= link_to_function "remove", "remove_fields(this)" %>
    </p>
  <% end %>

  <p><%= link_to_add_fields "Add feature", f, :features %></p>

  <p>
    <%= f.submit 'Save' %>
  </p>
<% end %>

Ok i used <%= image_tag builder.object.photo.url(:small) %> instead of
<%= image_tag :photo.url(:small) %>
Seems to work now