Closed rhunals closed 4 years ago
It is rarely the case for datagrid to have such issues.
Does the following return true
for the required record?
User.joins(;avatar_attachment).find(...).avatar.attached?
It is rarely the case for datagrid to have such issues.
Does the following return
true
for the required record?User.joins(;avatar_attachment).find(...).avatar.attached?
returns
true
.
There is an issue in scope in this query User.joins(:avatar_attachment)
here, I am getting record
of user
, which is correct, but getting wrong record.id
, which is not of that user.
column(:avatar, html: true, header: 'Avatar') do |record|
record.id => 61
User.joins(:avatar_attachment).pluck(:id) => [33, 41, 42, 53, 57]
What is the query generated by User.joins(:avatar_attachment).pluck(:id)
and by datagrid when you call UserGrid.new.assets
?
No feedback, closing.
user.rb
Inspected the same user in rails console
@user.avatar.attached? => true
but displaying
false
for all users indatagrid
column.Inspected
record.avatar.attached?
from datagrid column, gettingfalse
Requirement: Display all User records that have an attachment and also display
attachment
in grid column.Issue: As
attachment
is showingnil
, so unable to display attachment in grid.