[英]syntax error, unexpected tIDENTIFIER, expecting ';' or '\n'
I just copied and pasted code from tutorial in my file models/post.rb 我只是在我的文件models / post.rb中复制并粘贴了教程中的代码
class Post < ActiveRecord::Base
attr_accessible :content, :name, :title
validates :name, :presence => true
validates :title, :presence => true,
:length => { :minimum => 5 }
end
and am getting an error: 并收到一个错误:
SyntaxError: /home/row/blog/app/models/post.rb:1: syntax error, unexpected tIDENTIFIER, expecting ';' or '\n'
...idates :name, :presence => true
... ^
I made some changes in the code like: 我在代码中做了一些更改,如:
class Post < ActiveRecord::Base
attr_accessible :content, :name, :title
validates :name, :presence => true
validates :title, :presence => true, :length => { :minimum => 5 }
end
But the same error appears. 但是出现了同样的错误。 I am confused.
我很困惑。
You've got the wrong line endings. 你有错误的行结尾。 Try changing them to be UNIX line endings.
尝试将它们更改为UNIX行结尾。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.