You have a typo: lenght
should be length
.
Why am I getting an error? (controllers, and syntax) CHAPTER 2
-
03-10-2022 - |
سؤال
EDIT: The real ERROR was this, this is constantly showing up, before was in microposts controller, I reset all (delete, create, see), and now I'm getting the same error but on users.controller when creating a new user.
# undefined method `content' for #<User:0x00000103b48238>
respond_to do |format|
if @user.save #the error is supposed to be here.
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render action: 'show', status: :created, location: @user }
else
I'm on railstutorial by michael hartl. Yesterday I was trying to make the scaffold app on chapter 2, and I started getting a lot of errors.
So I had to put this piece of code on micropost.rb
class Micropost < ActiveRecord::Base
validates :content, lenght: { maximum: 140 }
end
and this is my code
class Micropost < ActiveRecord::Base
validates :content, lenght: { maximum: 140 }
end
Why did I get an error? Why one single point matters here?
I get another error, a lot of gems were getting a lot of errors ( I DIDN'T TOUCH 1 ), I update the gems and voilá, is this normal?
المحلول
لا تنتمي إلى StackOverflow