Skip to main content

Advanced Messaging with Mailboxer: Adding Attachments Discussion

General • Asked by Chris Oliver

Perfect! Thanks!


How does one go about adding multiple attachments?


How to do this with Refile gem?


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


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


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?


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.