草庐IT

recipient

全部标签

ruby-on-rails - rails : How to send emails to a recipient containing umlauts?

我想发送一封具有以下设置的电子邮件defregistration_confirmation(user)recipientsuser.username+""from"NetzwerkMuensterland"subject"VielenDankfürIhreRegistrierung"body:user=>usercontent_type"text/html"end主题行包含变音符号并且工作正常。日志告诉我,它是这样编码的:=?utf-8?Q?Vielen_Dank_f=C3=BCr_Ihre_Registrierung?=但是,如果user.username包含变音符号,则电子邮件将不

ruby-on-rails - has_many :messages where user is recipient or author in one query

我的消息模型属于作者和收件人。belongs_to:recipient,:class_name=>"User",:foreign_key=>"recipient_id"belongs_to:author,:class_name=>"User",:foreign_key=>"author_id"现在我想做的是在用户模型中设置一个has_many关系,该关系在单个查询中获取所有消息,其中用户是ether作者或收件人。我该怎么做?has_many:messages,:finder_sql=>['author_id=#{self.id}orrecipient_id=#{self.id}']但是