前提・実現したいこと
progateのログインを実装するところのuserにpasswordを設定するところでエラーを吐かれました
発生している問題・エラーメッセージ
C:\Users\kajim\OneDrive\ドキュメント\GitHub\ruby_rails\sample_app>rails c Loading development environment (Rails 5.0.7.2) irb(main):001:0> user = User.find_by(id: 1) User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]] => #<User id: 1, name: "dsdsd", email: "dsdsdsasla;sla", created_at: "2019-10-23 10:27:02", updated_at: "2019-10-25 07:55:28", image_name: "1.jpg"> irb(main):002:0> user.password="kaji" Traceback (most recent call last): 9: from bin/rails:4:in `<main>' 8: from bin/rails:4:in `require' 7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>' 6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!' 5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:78:in `console' 4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-5.0.7.2/lib/rails/commands/console_helper.rb:9:in `start' 3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-5.0.7.2/lib/rails/commands/console.rb:65:in `start' 2: from (irb):2 1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activemodel-5.0.7.2/lib/active_model/attribute_methods.rb:433:in `method_missing' NoMethodError (undefined method `password=' for #<User:0x00000000074b10e8>)
該当のソースコード
NoMethodError (undefined method `password=' for #<User:0x00000000074b10e8>)
試したこと
一回消してやり直してのですがうまくいきませ
補足情報(FW/ツールのバージョンなど)
Rails 5.0.7.2
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
回答1件
あなたの回答
tips
プレビュー