Forum: Ruby on Rails Putting "RE:" in the subject line of Private Messages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Scott H. (Guest)
on 2007-01-29 18:33
Hey guys,

My app has a private messaging system and I need to be able to put “Re:”
in the subject line when a user replies to a message.

Something like this…

***message_reply.html****

<input type="text"  value="Re: <%= @message.subject %>">

*************************

My problem is how do I stop the “Re:” building up when I save it to the
database.

I don’t want this …

Re: Re: Re: Re:

Any Ideas how this could be done?
Scott H. (Guest)
on 2007-01-29 18:34
obviously I meant

***message_reply.rhtml****
Jakob S. (Guest)
on 2007-01-30 19:35
(Received via mailing list)
Scott H. wrote:
> My app has a private messaging system and I need to be able to put “Re:”
> in the subject line when a user replies to a message.
[...]
> <input type="text"  value="Re: <%= @message.subject %>">
[...]
> My problem is how do I stop the “Re:” building up when I save it to the
> database.

In the above case it could be done with something like:

<%= 'Re: ' unless @message.subject.starts_with?('Re:') %>

But it strikes me as something that's better placed in the model, not
the UI.

--
Jakob S. - http://mentalized.net
This topic is locked and can not be replied to.