The records returned are used in a scaffold generated list page. The
edit,
show, and destroy links are getting the wrong id. They are getting the
id of
the table b record.
When I run the query using mysql, I see that the query returns 2 id
columns, the id of the main table, and the id of the join table. The
objects
returned have only one id, and apparently its the last one. It would be
better for it to be the first one.
Any suggestions for me?
This is used with paginate.
I think I’m using the native ruby mysql adapter, as compared to the c
version.
When I run the query using mysql, I see that the query returns 2 id
columns, the id of the main table, and the id of the join table. The
objects returned have only one id, and apparently its the last one. It
would be better for it to be the first one.
Either use :select => ‘table_a.*, table_b.some_data, …’,
or instead of the join use a belongs_to association plus
find’s :include option.
–
We develop, watch us RoR, in numbers too big to ignore.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.