Model - syntax error

I’ve been following the rails 2.0.2 tutorial at

I get the syntax error below after I put in the relation. I cut and
pasted the relation for all three models from the website to be sure
that there wasn’t a typo. Any ideas?

/Projects/expenses/app/models/event.rb:2: syntax error, unexpected
tIDENTIFIER, expecting kEND
validates_presence_of :name
validates_numericality_of :budget, :greater_than => 0.0

has_many :expenses
has_many :vendors, :through => :expenses
^
/Projects/expenses/app/models/event.rb:2: syntax error, unexpected
tASSOC, expecting tCOLON2 or ‘[’ or ‘.’
validates_presence_of :name
validates_numericality_of :budget, :greater_than => 0.0

has_many :expenses
has_many :vendors, :through => :expenses

Here are my relations

class Expense < ActiveRecord::Base
belongs_to :event
belongs_to :vendor
end

class Event < ActiveRecord::Base
validates_presence_of :name
validates_numericality_of :budget, :greater_than => 0.0

has_many :expenses
has_many :vendors, :through => :expenses
end

class Vendor < ActiveRecord::Base
has_many :expenses
has_many :events, :through => :expenses
end

-Anthony

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs