railer@anunciosserver:~/iptel$ vi app/views/imagenes/new.rhtml
New imagenes
<%= form_tag_with_upload_progress ({:action => 'create'}) %>
<%= upload_status_tag %>
<%= render :partial => 'form' %>
<%= submit_tag "Create" %>
<%= end_form_tag %>
<%= link_to 'Back', :action => 'list' %>
railer@anunciosserver:~/iptel$ vi app/controllers/imagenes_controller.rb
class ImagenesController < ApplicationController
upload_status_for :create
def index
list
render :action => 'list'
end
def list
@imagenes_pages, @imagenes = paginate :imagenes, :per_page => 10
end
def show
@imagenes = Imagenes.find(params[:id])
end
def new
@imagenes = Imagenes.new
end
def create
@imagenes = Imagenes.new(params[:imagenes])
if @imagenes.save
flash[:notice] = 'Imagenes was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
def edit
@imagenes = Imagenes.find(params[:id])
end
def update
@imagenes = Imagenes.find(params[:id])
if @imagenes.update_attributes(params[:imagenes])
flash[:notice] = 'Imagenes was successfully updated.'
redirect_to :action => 'show', :id => @imagenes
else
render :action => 'edit'
end
end
def destroy
Imagenes.find(params[:id]).destroy
redirect_to :action => 'list'
end
def upload_status
render :inline => '<%= upload_progress_status %> Updated: <%= Time.now %>
', :layout => false
end
end