OK, I got the relationship side of things sorted out for my rails
application!
class User < ActiveRecord::Base
has_many :userevents
has_many :events, :through => :userevents
class Event < ActiveRecord::Base
has_many :userevents
has_many :users, :through => :userevents
class Userevent < ActiveRecord::Base
belongs_to :user
belongs_to :event
When I want to see what events a user belongs to, surely the following
should work:
Now, calling @user = User.find(params[:id]).events
but not the case, it returns the following error:
compile error
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1359:
parse error, unexpected tINTEGER
Object::1
^
A google search gives something about using reserved words in my
database table but (for the time being) the only columns that exist are
id, user_id and event_id.
I’m going crazy!
Cheers
Mike