Attaching file to email Active Storage
Hi Guys,
I am trying to attach a pdf to an email via active storage. Here is my code below and the error I am getting.
class Assignment < ApplicationRecord
  has_one_attached :upload
  belongs_to :user
  belongs_to :course
  belongs_to :lesson
after_save :send_notifications
def send_notifications
    AssignmentMailer.notify_user(user).deliver_later
    AssignmentMailer.notify_team(user, upload).deliver_later
  end
end
ERROR:
No such file or directory @ rb_sysopen - /rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--889c8cda6fbfb3c827ff5bcd7a4ca7ff1594a37e/weekend.pdf
Thanks,
Steve
Changed to _url and not get this error:
Unsupported argument type: ActiveStorage::Attached::One
Extracted source (around line #35):
  def send_notifications
    AssignmentMailer.notify_user(user).deliver_later
    -- AssignmentMailer.notify_team(user, upload).deliver_later ---
  end
end