Michael Hartl Tutorial V. 2 الفصل 7.17 Nomethoderror في المستخدمين # خط جديد 4

StackOverflow https://stackoverflow.com/questions/9509230

  •  14-11-2019
  •  | 
  •  

سؤال

بعد البحث في هذا المنتدى، لقد وجدت أنني في طريق مسدود في هذه المشكلة.أنا أشغل القضبان 3.2.1 و Ruby 1.9.3

لقد اتبعت كتاب هارتل عن كثب ويعاني من خطأ في الاختبار وفي تقديم صفحة التسجيل.

هنا هو الخطأ مع بعض التتبع: giveacodicetagpre.

هنا هو بلدي new.html.erb: giveacodicetagpre.

وهنا هو مستخدمي_Controller.rb giveacodicetagpre.

الاختبار الذي يفشل: giveacodicetagpre.

ورسائل الخطأ من RSPEC: giveacodicetagpre.

أي مساعدة في هذا سيكون موضع تقدير كبير.شكرا مقدما، براين.

هل كانت مفيدة؟

المحلول

That error occurs when the @user object you're passing to form_for is nil. If you look in your controller, the new method is defined twice, and in the second definition it does not instantiate a @user object.

Delete the second (empty) definition of the new method in your controller and you should be good to go.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top