mailboxer

Ruby on Rails - ActiveRecord::Relation count method is wrong?

爷,独闯天下 提交于 2019-11-30 18:11:25
问题 I'm writing an application that allows users to send one another messages about an 'offer'. I thought I'd save myself some work and use the Mailboxer gem. I'm following a test driven development approach with RSpec. I'm writing a test that should ensure that only one Conversation is allowed per offer. An offer belongs_to two different users (the user that made the offer, and the user that received the offer). Here is my failing test: describe "after a message is sent to the same user twice"

Adding belongs to relationship to Ruby Gem Mailboxer

痞子三分冷 提交于 2019-11-30 16:14:26
问题 I am building an e-com application and would like to implement something like a messaging system. In the application, all conversation will be related to either a Product model or an Order model. In that case, I would like to store the relating object (type + id, I supposed) to the Conversation object. To add the fields, of course I can generate and run a migration, however, since the Model and Controller are included within the gem, how can I declare the relationship? ( belongs_to :linking

Adding belongs to relationship to Ruby Gem Mailboxer

僤鯓⒐⒋嵵緔 提交于 2019-11-30 15:52:38
I am building an e-com application and would like to implement something like a messaging system. In the application, all conversation will be related to either a Product model or an Order model. In that case, I would like to store the relating object (type + id, I supposed) to the Conversation object. To add the fields, of course I can generate and run a migration, however, since the Model and Controller are included within the gem, how can I declare the relationship? ( belongs_to :linking_object, :polymorphic ) and the controller? Any idea? Thank you. I ended up customizing the Mailboxer gem