Il y avait 4 questions en tout :

   - répondu : quelle version de rails ?
   - répondu : qu'est-ce qui se trouve dans la migration qui crée la table
   products ?
   - en attente : est-ce que tu as vérifié la table dans la base de données
   ?
   - en attente : comment est déclaré le modèle Product ?

Cordialement.

Michel Belleville


2009/11/27 Bobo Bobo <[email protected]>

>
> Effectivement, majuscule ou minuscule ne change rien à la rénération du
> sccafold.
>
> Michel Belleville > Comme dit dasns mo prgemier post, c'est du rail 2.0
>
> Mon fichier 001_create_products.rb donne ca :
>
> class CreateProducts < ActiveRecord::Migration
>  def self.up
>    create_table :products do |t|
>      t.string :title
>      t.text :description
>      t.string :image_url
>
>      t.timestamps
>    end
>  end
>
>  def self.down
>    drop_table :products
>  end
> end
>
> Et le products_controller.rb ca :
>
> class ProductsController < ApplicationController
>  # GET /products
>  # GET /products.xml
>  def index
>    @products = Product.find(:all)
>
>    respond_to do |format|
>      format.html # index.html.erb
>      format.xml  { render :xml => @products }
>    end
>  end
>
>  # GET /products/1
>  # GET /products/1.xml
>  def show
>    @product = Product.find(params[:id])
>
>    respond_to do |format|
>      format.html # show.html.erb
>      format.xml  { render :xml => @product }
>    end
>  end
>
>  # GET /products/new
>  # GET /products/new.xml
>  def new
>    @product = Product.new
>
>    respond_to do |format|
>      format.html # new.html.erb
>      format.xml  { render :xml => @product }
>    end
>  end
>
>  # GET /products/1/edit
>  def edit
>    @product = Product.find(params[:id])
>  end
>
>  # POST /products
>  # POST /products.xml
>  def create
>    @product = Product.new(params[:product])
>
>    respond_to do |format|
>      if @product.save
>        flash[:notice] = 'Product was successfully created.'
>        format.html { redirect_to(@product) }
>        format.xml  { render :xml => @product, :status => :created,
> :location => @product }
>      else
>        format.html { render :action => "new" }
>        format.xml  { render :xml => @product.errors, :status =>
> :unprocessable_entity }
>      end
>    end
>  end
>
>  # PUT /products/1
>  # PUT /products/1.xml
>  def update
>    @product = Product.find(params[:id])
>
>    respond_to do |format|
>      if @product.update_attributes(params[:product])
>        flash[:notice] = 'Product was successfully updated.'
>        format.html { redirect_to(@product) }
>        format.xml  { head :ok }
>      else
>        format.html { render :action => "edit" }
>        format.xml  { render :xml => @product.errors, :status =>
> :unprocessable_entity }
>      end
>    end
>  end
>
>  # DELETE /products/1
>  # DELETE /products/1.xml
>  def destroy
>    @product = Product.find(params[:id])
>    @product.destroy
>
>    respond_to do |format|
>      format.html { redirect_to(products_url) }
>      format.xml  { head :ok }
>    end
>  end
> end
>
> Le problème intervient à la création d'un nouveau produit. La page de
> formulaire products/new.
> --
> 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 à