I have a large, existing code base for a project that's been on hiatus. 
Last time I was working on the project, all automated unit tests were 
running perfectly. Now that I've come back to it, I'm suddenly hitting 
errors on previously existing dataset declarations that rely on 
the <table_name>__<column_name> syntax to specify a column in a particular 
table (to keep things straight when joining tables that share column names).


For example, here's one of my models:

module DonorSee
  class Project < Sequel::Model
    set_dataset dataset.exclude(status: 
'banned').order(:projects__created_at).reverse
    ....
  end
end


And here's the error I'm hitting during automation testing (using MiniTest 
and Guard):

Sequel::DatabaseError:         Sequel::DatabaseError: PG::UndefinedColumn: 
ERROR:  column "projects__created_at" does not exist

        LINE 1: ...M "projects" WHERE ("projects"."id" = 4) ORDER BY 
"projects_...
 

What's even weirder is that I was able to reproduce the same error using 
Pry, which interacts with my development database as opposed to my test 
database. If I attempted to use <table_name>__<column_name> syntax, it 
would tell me "column ... does not exist." But after trying a few things to 
sort out my dev environment, I no longer see the error when I use Pry, but 
still see it when running MiniTest.

Here's some relevant environment info:

Barbaras-MacBook-Pro:donorsee-api barbara$ rbenv version

2.3.1 (set by /Users/barbara/.rbenv/version)

Barbaras-MacBook-Pro:donorsee-api barbara$ gem list sequel


*** LOCAL GEMS ***


sequel (5.4.0, 4.40.0, 4.36.0, 4.35.0, 4.34.0)

sequel_pg (1.8.1, 1.6.17)

Barbaras-MacBook-Pro:donorsee-api barbara$ gem list pg


*** LOCAL GEMS ***


pg (1.0.0, 0.21.0, 0.18.4)

sequel_pg (1.8.1, 1.6.17)


-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to