Reputation: 119
I just copied and pasted code from tutorial in my file 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.
Upvotes: 1
Views: 1463
Reputation: 2169
You've got the wrong line endings. Try changing them to be UNIX line endings.
Upvotes: 3