I have been working on user massaging for my rails app using the mailboxer gem.
For some reason I can't render the messages form and my values aren't being passed, like user.id What's a way of doing this? I know I'm close but I'm fondling hardcore with this one In my views/posts/show.html.erb:
<strong>title & author</strong>
<h2><%= @post.title %></h2>
<p><%= @post.author %></p>
</div>
<strong>course</strong><br />
<h1><%= @post.course %></h1>
<strong>school</strong><br />
<h1><%= @post.school %></h1>
<strong>price</strong><br />
<h1><%= @post.price %></h1>
<p>
<strong>Posted by</strong><br />
<%= @post.email %>
</p>
<br />
<h2>Description</h2>
<h1><%= word_wrap(@post.description, :line_width => 8) %></h1>
<br />
DATE POSTED: <%= @post.created_at %><br /><br />
</div>
<%= link_to "reply", new_message_path %>
<!--%= render 'messages/form', conversation: conversation % -->
When I click on new message path this is the page it goes to: view/messages/new.html.erb
Send a message to
<%= @user.username %>
<%= form_tag({controller: "messages", action: "create"}, method: :post) do %>
<%= label_tag :subject %>
<%= text_field_tag :subject %>
<%= label :body, "Message text" %>
<%= text_area_tag :body %>
<%= hidden_field_tag(:user, "#{@user.id}") %>
<%= submit_tag 'Send message' %>
<% end %>
I would like to pass the value of the username of the post, or pass post.email to the messages form.
The other way I tried to do it, and the way I prefer of doing it is to <%= render 'messages/form', conversation: conversation %> but when I do that I get
undefined method error for 'conversation'
views/messages/_form.html.erb:
Reply:
<%= form_for :message, url: [:reply, conversation] do |f| %>
<%= f.text_area :body %>
<%= f.submit "Send Message", class: 'btn btn-primary' %>
<%= submit_tag 'Clear Reply Box', type: :reset, class: 'btn btn-danger' %>
<% end %>
Basically I want to add a reply button to a post and let the user send a message to the user who posted. I'm using devise and all users are logged in.