Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. undefined method 'mailboxer_email" for #<User:0x007f6ed0907040>
  2.  
  3. class MessagesController < ApplicationController
  4.  
  5.  
  6. def new
  7. @user = User.find_by_username(params[:user])
  8. @message = current_user.messages.new
  9.  
  10. # POST /message/create
  11. def create
  12. @recipient = User.find_by_username(params[:user])
  13. current_user.send_message(@recipient, params[:body], params[:subject])
  14. flash[:notice] = "Message has been sent!"
  15. redirect_to :conversations
  16. end
  17.  
  18. end
  19.  
  20. <%= conversation.subject %>
  21.  
  22. A conversation with
  23. <% conversation.participants.each do |participant| %>
  24. <% if participant != current_user %>
  25. <%= participant.username%>
  26. <% end %>
  27. <% end %>
  28. <%= content_tag_for(:li, conversation.receipts_for(current_user)) do |receipt| %>
  29. <% message = receipt.message %>
  30. <%= message.sender.username %>
  31.  
  32. <%= simple_format h message.body %>
  33.  
  34. Sent <%= conversation.updated_at.strftime("%a, %m/%e/%Y %I:%M %p") %>
  35.  
  36. <% end %>
  37.  
  38. <%= render 'messages/form', conversation: conversation %>
  39.  
  40. Reply:
  41. <%= form_for :message, url: [:reply, conversation] do |f| %>
  42. <%= f.text_area :body %>
  43. <%= f.submit "Send Message", class: 'btn btn-primary' %>
  44. <%= submit_tag 'Clear Reply Box', type: :reset, class: 'btn btn-danger' %>
  45. <% end %>
  46.  
  47. Send a message to
  48.  
  49. <%= @user.username %>
  50. <%= form_tag({controller: "messages", action: "create"}, method: :post) do %>
  51. <%= label_tag :subject %>
  52. <%= text_field_tag :subject %>
  53. <%= label :body, "Message text" %>
  54. <%= text_area_tag :body %>
  55. <%= hidden_field_tag(:user, "#{@user.username}") %>
  56. <%= submit_tag 'Send message' %>
  57. <% end %>
  58.  
  59. def mailboxer_email(object)
  60. #return the model's email here
  61. end
  62.  
  63. Mailboxer.setup do |config|
  64. # ...
  65. #Configures the methods needed by mailboxer
  66. config.email_method = :email
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement