row248
row248

Reputation: 119

syntax error, unexpected tIDENTIFIER, expecting ';' or '\n'

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

Answers (1)

Alyssa Ross
Alyssa Ross

Reputation: 2169

You've got the wrong line endings. Try changing them to be UNIX line endings.

Upvotes: 3

Related Questions