Je viens de me rendre compte que j'ai oublier le controleur :-S.

Donc le voici le voila :

  #############################
  #   Gestion TABLE FICHIERS  #
  #############################

  def joindre_tablefichier
    @td = Tabledocument.find_by_id params[:id]
    @tf = Tablefichier.new
    flash[:td] = @td
    flash[:tf] = @tf
  end

  def modifier_tablefichier
    @tf = Tablefichier.find_by_id params[:id]
    @td = Tabledocument.find_by_id params[:id]
    flash[:tf] = @tf
    flash[:td] = @td
    redirect_to :action=>"afficher_tabledocument"
  end

  def supprimer_tablefichier
    id = params[:tf.id]
    tf = Tablefichier_by_id tf.id
    tf.destroy
    redirect_to :action=>"lister_tablefichier"
  end

  def afficher_tablefichier
    @tdcs = []
     tdcs = Tablecode.find :all, :conditions=>"CoType = 'TDC'" 
,:order=>"coLibelle asc"
    tdcs.each { |tcs|
      @tdcs << [tcs.coLibelle, tcs.id]
    }
    @exts = []
    exts = Tablecode.find :all, :conditions=>"CoType = 'EXT'" 
,:order=>"coLibelle asc"
    exts.each { |tcs|
      @exts <<[tcs.coLibelle, tcs.id]
    }
    @td = flash[:td]
    @tf = flash[:tf]
  end

  def valider_tablefichier
    id = params[:id]
    if id.nil?
      @tf = Tablefichier.create params[:tf]
    else
      @tf = Tablefichier.update id, params[:tf]
    end
    if @tf.errors.count == 0
      redirect_to :action=>"index"
    else
      redirect_to :action=>"afficher_tablefichier"
    end
  end

  def lister_tablefichier
    @tfs = Tablefichier.find :all
  end
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
Vous avez reçu ce message, car vous êtes abonné au groupe "Railsfrance" de 
Google Groups.
Pour transmettre des messages à ce groupe, envoyez un e-mail à l'adresse 
[email protected]
Pour résilier votre abonnement envoyez un e-mail à l'adresse [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Répondre à