Note uses a polymorphic association, but the notable_id is of type String. This is done to accomodate notes on commits (which are not ActiveRecord objects).
The problem is that Postgres does not typecast "notable_id = 1" properly. This is not an issue with MySQL and Sqlite3.
If anyone has a good solution for this, please let me know.
By Administrator on 2012-03-16T10:29:38 (imported from GitLab)
def upvotes count = 0 notes = Note.find(:all, :conditions => ["noteable_id = '?'", self.id]) if notes notes.each do |n| count+=1 if n.upvote? end end countend
I was able do just workaround.
By Administrator on 2012-03-27T19:23:42 (imported from GitLab)
I would be glad to help with postgresql support. Is somebody working on that?
Should I try to collect all the patches mentioned here and work on getting the test suite green?
Regards
Quentin
By Administrator on 2012-05-11T09:56:22 (imported from GitLab)
Is it possible to add conditional migration and execute following if database is PostgreSQL:
CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
May be just ingnoring exceptions, like that:
class FixPostgresqlMigration < ActiveRecord::Migration def up execute <<-SQL CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT; SQL rescue ActiveRecord::StatementInvalid end def down endend
By Administrator on 2012-06-22T10:55:17 (imported from GitLab)