Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AuthLogic + PostgreSQL 8.4: persistence_token defined as a string, then used as integer

I'm trying to integrate AuthLogic into my rails application, and I followed the example which defines persistence_token as a string :

https://github.com/binarylogic/authlogic_example

However when I run it with PostgreSQL 8.4 on my ubuntu desktop I get the following error :

ActiveRecord::StatementInvalid in UsersController#index

PGError: ERROR:  operator does not exist: character varying = integer
LINE 1: ...* FROM "users" WHERE ("users"."persistence_token" = 21007622...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT * FROM "users" WHERE ("users"."persistence_token" = 2100762299)  LIMIT 1

I tried to change persistence_token to an integer, but then it seemed other parts of AuthLogic did not update it.

I'm sure this must be a common problem but googling around was not very helpful, any ideas how to resolve this?

Ruby version: 1.8.7 Rails version: 2.3.5 AuthLogic version: 2.1.6

like image 646
hellomynameisjoel Avatar asked Jun 11 '26 13:06

hellomynameisjoel


1 Answers

This is a problem because the rows in your table have a 'persistence_token' value of nil. Setting the column to a value will cause this error to go away. I suspect it has something to do with the way rails inspects the table columns and its interaction with authlogic.

like image 134
FooManChew Avatar answered Jun 13 '26 19:06

FooManChew