Bonjour à tous !

Comme beaucoup je débute l'apprentissage de ruby avec le livre "Ruby on
Rails 2e édition". Je dois avoué que je suis bloqué avec le scaffold.

J'ai vu que son utilisation avait changé entre l'écriture du livre et
l'apparition de rail 2.0. J'ai donc adapté mais ca ne fonctione toujours
pas.

Erreur affichée :
<code>undefined method `title' for #&lt;Product id: nil&gt;</code>
Extracted source (around line #8):
<code>5: &lt;% form_for(@product) do |f| %&gt;
6:   &lt;p&gt;
7:     &lt;b>Title&lt;/b>&lt;br /&gt;
8:     &lt;%= f.text_field :title %&gt;
9:   &lt;/p&gt;
10:
11:   &lt;p&gt;
</code>
RAILS_ROOT: E:/C-web/Ruby/Test/depot
<code>E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:205:in
`method_missing'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:562:in
`send'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:562:in
`value_before_type_cast'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:550:in
`value_before_type_cast'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:465:in
`to_input_field_tag'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:289:in
`text_field'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:640:in
`send'
E:/C-web/Ruby/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:640:in
`text_field'
app/views/products/new.html.erb:8:in
`_run_erb_47app47views47products47new46html46erb'
app/views/products/new.html.erb:5:in
`_run_erb_47app47views47products47new46html46erb'
app/controllers/products_controller.rb:29:in `new'</code>

Il me semble pourtant avoir suivi la procédure :
<code>Test>rails -d mysql depot
depot>ruby script/generate scaffold Product title:string desc
ription:text image_url:string
depot>rake db:migrate
depot>ruby script/server webrick
</code>

Quelqu'un peut-il m'aider ? Merci.
-- 
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 à