문제

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?

도움이 되었습니까?

해결책

You have a typo: lenght should be length.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top