任何人都知道rails 3.2的私人消息宝石?

时间:2012-06-20 05:07:36

标签: ruby-on-rails-3 ruby-on-rails-plugins

我花了一天时间来弄清楚如何通过设计在注册会员之间建立良好的信息系统。

但在所有情况下,这些宝石都已过时,并且它们不支持rails3。

如果你们正在尝试制作包含这些功能的系统。 你怎么做的?

  1. 会员注册(设计)
  2. 私人消息系统(带有收件人邮件)

2 个答案:

答案 0 :(得分:5)

https://github.com/ging/mailboxer

/config/initializer/mailboxer.rb:

Mailboxer.setup do |config|
  config.uses_emails = true  
  config.default_from = "no-reply@youraddress.com"
end

最小模型

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  acts_as_messageable

  attr_accessible :email, :password, :password_confirmation, :remember_me

  def name
    email
  end

  def mailboxer_email(object)
    email
  end  
end

当然还有星标邮件配置。

答案 1 :(得分:3)

您为什么要尝试使用ActionMailer?您是否在应用内发送电子邮件或消息?如果你只是在应用程序中进行私人消息传递,你应该能够创建一个PrivateMessage类:

class PrivateMessage
  has_one :sender, :class => 'User'
  has_one :recipient, :class => 'User'
end