All threads / Advanced Messaging with Mailboxer: Adding Attachments Discussion

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Advanced Messaging with Mailboxer: Adding Attachments Discussion

Perfect! Thanks!

Reply

How does one go about adding multiple attachments?

Reply

How to do this with Refile gem?

Reply

Thanks for the video. However I am trying to upload a file on the new conversations and it doesn't work. it works though on the reply when the conversion already exists.

<div class="row">
<div class="col-md-12">

<h1>New Conversation </h1>

<%= form_for @message, url: conversations_path do |f| %>

<div class="form-group">
<div class="col-md-8">
<% if current_user.admin? %>
<%= select_tag :user_ids, options_from_collection_for_select(@recipients, :id, :name),
multiple: true, class: 'form-control' %>
<% else %>
<%= select_tag :user_ids, options_from_collection_for_select(@recipients, :id, :name), class: 'form-control' %>
<% end %>
</div>
</div>

<div class="form-group">
<div class="col-md-8">
<%= f.text_field :subject, placeholder: "Subject", class: 'form-control' %>
</div>
</div>

<div class="form-group">
<div class="col-md-8">
<%= f.text_area :body, placeholder: "Your message goes here",
class: 'form-control' %>
</div>
</div>




<hr/>

<div class="form-group">
<div class="col-md-8">
<%= f.file_field :attachment %>
</div>
</div>




<hr/>

<div class="form-group">
<div class="col-md-8">
<%= f.submit "Send", class: 'btn btn-primary btn-lg' %>
</div>
</div>

<% end %>

</div>
</div>

It shows the following error

No route matches {:action=>"show", :controller=>"conversations", :id=>nil} missing required keys: [:id]

I tried replacing select_tag with f.select and its still doesn't work.

What could I be doing wrong?

Kind Regards,
Joseph

Reply

One question this is for messages between users in application or is to make a imap client ?

Reply

Great stuff. Thank you again!

Question: if someone does end up refactoring or updating the gem, does that mean that suddenly our mailbox uploading feature will cease to function? Or would that only be an issue if we updated to a revised version of the gem without making the required new changes to the code?

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,344+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.