Advanced Messaging with Mailboxer: Adding Attachments Discussion
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
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?
I love the insight that an out-of-date gem can be an opportunity to learn how to level up your skills. BTW, here's an update about mailboxer: someone has forked and has answered some of the pull requests.
If you want a more updated version of mailboxer, check this out: https://github.com/chriscz/mailboxer/issues/1