mailboxer

Model from Gem is missing

空扰寡人 提交于 2020-01-16 17:31:26
问题 I am using mailboxer in my Rails 4 app. gem 'mailboxer' I recently updated it from 0.11 to 0.12.4 , it stopped working, and I cant figure out why. Now, I am getting the error: uninitialized constant Message I checked the gem's GitHub repo and it does have the Message model. I checked my local version of the gem and it matches up. Puma:mailboxer Jeff$ pwd /Users/Jeff/.rvm/gems/ruby-2.0.0-p247/gems/mailboxer-0.12.4/app/models/mailboxer Puma:mailboxer Jeff$ ls conversation conversation.rb

Mailboxer Gem--Restrict messaging

百般思念 提交于 2019-12-25 12:45:35
问题 Mailboxer allows you to connect multiple models as in the example from the gem page. Mailboxer Github page You can use Mailboxer in any other model and use it in several different models. If you have ducks and cylons in your application and you want to exchange messages as if they were the same, just add acts_as_messageable to each one and you will be able to send duck-duck, duck-cylon, cylon-duck and cylon-cylon messages. How can we restrict messaging to only between duck-cylon and vice

accessing current_user in mailboxer mailer notification

南笙酒味 提交于 2019-12-25 08:15:23
问题 I'm trying to print user name into a mail template which has been created via rails g mailboxer:views. Whenever I try to call the method, raises an "method or variable current_user not found", although public methods as User. id do prints. Here's the view <!DOCTYPE html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> </head> <body> <h1>You have a new reply from <%= current_user.name %>: <%= @subject %></h1> <blockquote> <p> <%= raw @message.body %> </p> <

cannot figure out how to update mailboxer is_read

耗尽温柔 提交于 2019-12-25 03:00:54
问题 I am using the mailboxer gem and I am trying to make it so that after i look at a conversation (by accessing conversations#show), I want the is_read attribute of the receipt to turn true. However, the attribute will not turn true until I send a reply. I tried using the following line: receipt.update_attributes(is_read: true) but was returned the following error: Error (ActiveRecord::ReadOnlyRecord) I think I understand the error. I think it is saying that the attribute can only be read and

Show username on Mailboxer inbox in Rails

落花浮王杯 提交于 2019-12-13 04:48:30
问题 I'm using the Mailboxer (https://github.com/ging/mailboxer) gem in my Rails app to handle private messages between users. As per the documentation, I'm using = render mailbox.inbox to show a list of all conversations (messages) for the logged-in user. However, the method only outputs the subject of the message. I need to show the sender of the message along with the subject. How can I edit this output so that the sender name is displayed? The SQL table shows that the sender name is not stored

Using the Rails gem 'Mailboxer' and the sender_id is always zero

倾然丶 夕夏残阳落幕 提交于 2019-12-11 13:55:07
问题 Just integrated Mailboxer and I'm running into one problem. When I send a new message the sender_id in the mailboxer_notifications table is always zero instead of the id of the sender. I'm using the friendly_id gem for usernames and I think this is where the problem is but I cant find out how to fix it (if it even is the problem). messages/new.html.erb <% provide(:title, "New Message") %> <%= form_tag user_messages_path, method: :post do %> <div class="form-group"> <%= label_tag 'message

Mailboxer Gem, Admin View

前提是你 提交于 2019-12-11 10:46:47
问题 I'm using the mailboxer gem for conversations/messages between the User model in my app. This is all working fine, thanks to some great help in stack overflow. I'm now trying to setup a section so admin can view all the conversations that are happening. I have created a controller and view for conversations, nested in my admin section. I've pulled in all conversations on the index page with: def index @admin_conversations = Conversation.all end This has listed all the conversations, and a

How to access recipient on sent messages page with mailboxer

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 00:40:15
问题 I am using the mailboxer gem to send messages within my ruby on rails app. The gem is working. I can't for the life of me figure out how to access the recipient on the sent messages page. On the sent messages page, I am trying to loop through sent messages, and access the recipient of the sent messages and display that person to the user. On the regular inbox page, I used the following: <% all_mail = current_user.mailbox.inbox %> <% all_mail.each do |letter| %> <tr> <td><%= letter.messages

Rails mailboxer gem, send message to user using form

怎甘沉沦 提交于 2019-12-03 22:15:49
I have installed the mailboxer gem to my rails app. It's successfully working when i'm using it in the console. Exemple: current_user.send_message(User.last, "Body", "subject") But i want to know how to do to make it work with a form view and a controller. I want to be able to pass the send_message arguments through a view and send it to a message or a conversation controller. I don't know the right way to handle this fantastic gem. Thanks in advance J.D. The controller to send a message from a form: class MessageController # GET /message/new def new # display form end # POST /message/create

foreigner - remove foreign key

こ雲淡風輕ζ 提交于 2019-12-03 14:46:35
问题 I am trying to use mailboxer in my rails 4 app. A problem is arising when i try to deploy the db. The error occurs in creating the mailboxer conversations table, which has dependencies in notifications table. I am trying to remove the foreign key for notifications conversations. I created a migration which says: change_table :notifications do |t| t.remove_foreign_key :conversations However, the rake aborts and says a foreign key does not exist. rake aborted! An error has occurred, this and