【发布时间】:2012-06-20 05:07:35
【问题描述】:
我日复一日地研究如何通过设计在注册会员之间建立良好的消息传递系统。
但在所有情况下,这些 gem 都已过时且不支持 rails3。
如果你们正在尝试制作包含这些功能的系统。 你是怎么做的?
- 会员注册(设计)
- 私人消息系统(带有行动邮件程序)
【问题讨论】:
标签: ruby-on-rails-3 ruby-on-rails-plugins
我日复一日地研究如何通过设计在注册会员之间建立良好的消息传递系统。
但在所有情况下,这些 gem 都已过时且不支持 rails3。
如果你们正在尝试制作包含这些功能的系统。 你是怎么做的?
【问题讨论】:
标签: ruby-on-rails-3 ruby-on-rails-plugins
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
当然还有标准邮件配置。
【讨论】:
您为什么要尝试使用 ActionMailer?您是否在应用程序内发送电子邮件或消息?如果您只是在应用内进行私人消息传递,您应该可以创建一个PrivateMessage 类:
class PrivateMessage
has_one :sender, :class => 'User'
has_one :recipient, :class => 'User'
end
【讨论】: