Annoying rails error!

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

On 3/12/07, Mike [email protected] wrote:

Object::1
^

You have a type column in your database table. This is reserved for
single-table inheritance. Rename it.

jeremy

Jeremy K. wrote:

On 3/12/07, Mike [email protected] wrote:

Object::1
^

You have a type column in your database table. This is reserved for
single-table inheritance. Rename it.

jeremy

yep - found it, thanks for the help!

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