I am doing a join of two tables with a column with same name in both. I
am
using “includes” to have a full join. This is giving ambiguous column
error. The columns cannot be removed from either of those and renaming
any
of the two would involve two many changes. So, is there any way this can
be
resolved?
I am doing a join of two tables with a column with same name in both. I am
using “includes” to have a full join. This is giving ambiguous column error.
The columns cannot be removed from either of those and renaming any of the
two would involve two many changes. So, is there any way this can be
resolved?
On Fri, Dec 7, 2012 at 12:20 PM, Sumit S. < [email protected]> wrote:
Hi,
I am doing a join of two tables with a column with same name in both. I am
using “includes” to have a full join. This is giving ambiguous column
error. The columns cannot be removed from either of those and renaming any
of the two would involve two many changes. So, is there any way this can be
resolved?
try this
Foo.includes(:bar).order(‘foos.name, bars.name’).where(‘foos.name = ?
AND
bars.name = ?’, ‘fooname’, ‘barname’)
On Fri, Dec 7, 2012 at 3:17 PM, sumit srivastava < [email protected]> wrote:
I am doing a join of two tables with a column with same name in both. I
just specify the table you are trying to access.
How to write test cases for such errors? Is it possible?
If you’re going to ask me, I personally think that this specific error
should not be written a test case.
In the first place, the code will not run if there is such an error so
that
code shouldn’t be committed.
You received this message because you are subscribed to the Google
On Fri, Dec 7, 2012 at 1:27 AM, Jim Ruther N. [email protected]
wrote:
am using “includes” to have a full join. This is giving ambiguous column
just specify the table you are trying to access.
How to write test cases for such errors? Is it possible?
If you’re going to ask me, I personally think that this specific error
should not be written a test case.
In the first place, the code will not run if there is such an error so that
code shouldn’t be committed.
Well, no, that’s not really the test you want to write.
The test to write is (before you’ve implemented the (bad?) code) one
that will compare a given initial condition (setting test data in
tables) will return the expected value (a data set with the combined
tables). Often writing the test will enable you to determine how to
write the code, and foresee potential problems.