Joseph Mokenela
Joined
Activity
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