I’ve been following the rails 2.0.2 tutorial at
http://developer.apple.com/tools/developonrailsleopard.html
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