ruby on rails - has_one association isn't working -


i have following activerecord models:

class user < activerecord::base   has_one :faculty end  class faculty < activerecord::base   belongs_to :head, class_name: 'user', foreign_key: :user_id end 

when try pull user using association faculty.head record without errors, when type user.faculty error:

  faculty load (1.8ms)  select "faculties".* "faculties" "faculties"."user_id" = 1 limit 1 activerecord::statementinvalid: pg::undefinedfunction: error:  operator not exist: character varying = integer line 1: ...".* "faculties"  "faculties"."user_id" = 1 limit ... 

my faculties db schema looks this:

create_table "faculties", :force => true |t|     t.string   "name"     t.datetime "created_at", :null => false     t.datetime "updated_at", :null => false     t.string   "user_id"  end 

is pg bug??

the error occurs because have user_id column string, not integer.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -