Method to send multiple paperclip attachments through actionmailer in rails -


so need mailer send attachments user uploads in form upon creation. used cocoon , paperclip attach multiple files in form.

here object_controller:

class rfqscontroller < applicationcontroller ...    def create     @object= rfq.new(rfq_params)      respond_to |format|       if @object.save         object_mailer.object_message(current_user, @object).deliver         format.html { redirect_to @object, notice: 'object created.' }          format.html { render :new }       end     end   end  ... 

this send email multiple attachments

class objectmailer < applicationmailer    default from: "test@test.com"   def placeholder_message(user, rfq)     @user = user      object.object_attachments.each |attachment|       attachments[attachment.attachment_file_file_name] = file.read(attachment.attachment_file.path)     end      mail to: user.email, subject: "test"    end  end 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -