Hey, I am working on Rails App and I am a bit wobbly on my syntax. I would like to send one of two kinds of send_file statements to a user depending on which kind of downloadable they ordered. I have basically just expanded on the depot code in the Agile Dev book.

Here is some of the code as it now stands.


Code:
  
def download
    begin
      @order = Order.find(params[:id], :conditions => "ordered_at >= DATE_SUB(NOW(), INTERVAL 1 DAY)")
    rescue
      redirect_to_index("Sorry, that's an invalid order.")
    end
    begin
      @file = @order.line_items.find(:first, :conditions => ["deliverable_id = ?", params[:file]])
    rescue
      redirect_to_index("Sorry, you did not order that file.")
      return
    end  
    send_file "#{PDF_ROOT}/#{@file.deliverable.product.title.delete " "}.pdf", :type => 'application/pdf'
  end

What I would like to change is that last send_file bit to accomodate a statement like the following:

Code:
if deliverable.type == 1
    send_file "#{PDF_ROOT}/#{@file.deliverable_id " "}.pdf", :type => 'application/pdf'

if deliverable.type == 2
    send_file "#{MP3_ROOT}/#{@file.deliverable_id " "}.mp3", :type => 'audio/mpeg'
Also, how might I structure the opposite of this next phrase:

Code:
if item.deliverable.download == 0
I mean how would I state if the deliverable does not equal 0?

Thanks a ton, in advance. Peace.