class Attachment < ActiveRecord::Base
validates_presense_of :title

has_attached_file :image,
:styles => {:default => '720x720',
:thumb => '80x80',
:tiny => '40x40'}

has_attached_file :video

end

class AttachmentsController < ApplicationController
def create
@attachment = Attachment.new(params[:attachment])

respond_to do |format|
if @attachment.save
flash[:message] = 'ok'
format.html { render :action => "index" }
format.xml { render :xml => @attachment, :status => :created }
else
flash[:message] = 'error'
format.html { render :action => "new" }
format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }
end
end
end
end