All pastes #42162 Raw Edit

Anonymous

public text v1 · immutable
#42162 ·published 2006-02-20 01:05 UTC
rendered paste body
railer@anunciosserver:~/iptel$ vi app/views/imagenes/new.rhtml
<h1>New imagenes</h1>

<%= 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 %> <div>Updated:  <%= Time.now %></div>', :layout => false
  end

end