hzamani/acts_as_relation

unknown attribute: as_user_id [HELP]

Closed this issue · 0 comments

Hi All,

I would implement Acts_as_relation gem, but I have some difficult to do it.
I have Users and Students, all students are users.
I'm using rails 3 and SQLite

Here is my code :

class User < ActiveRecord::Base
  acts_as_superclass
  attr_accessible :uid, :name, :surname, :idperson, :created_at, :updated_at, :subtype,
end

class Student < ActiveRecord::Base
  acts_as :user
  attr_accessible :titel, :birth, :origin, :last_connected_at
end

My migration file :

class AddRelationSuperclass < ActiveRecord::Migration
  def change
    change_table :users, :as_relation_superclass => true do |t|

    end
  end

  def down
  end
end

But now, when I create a student, I have always this error message :

 - ActiveRecord::UnknownAttributeError: unknown attribute: as_user_id

As it's explained in the wiki, the migration :

change_table :users, :as_relation_superclass => true do |t|

end

should add a foreign key in the user table, right ?

How can I solve this ?

Please help me !!

Many thanks in advance

Nicolas