Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
sending email body text based on form content
Jason Pfeifer
1/23/2006 1:07:00 AM
As a noob to Rails and web development in general, I think I still need
a broader understanding of how Views, Controllers, and Models pass
information and variables to each other.
I'm creating a site that allows for email campaigns. I have a
'create_email_controller':
class Admin::CreateEmailController < Admin::BaseController
layout 'admin'
def index
write
render :action => 'write'
end
def write
@email = Email.new
end
def email_list
email = Email.find(:all)
email.each { |address| MailList::deliver_send_email(address) }
redirect_to (:action => @section)
end
end
where I want the user to type a message body into a textarea field:
<%= error_messages_for 'email' %>
<!--[form:email]-->
<p><label for="email_message">Message</label><br/>
<%= text_area 'email', 'message' %></p>
<!--[eoform:email]-->
I want to pass from the form a variable @message to email_list in the
controller, which passes to the MailList model:
class MailList < ActionMailer::Base
def send_email(email)
@recipients = email.address
@from = 'info@toropaintballs.com'
@subject = 'Toro Paintball'
@body['full_name'] = email.fullname
## @message in here someway ##
end
end
which invokes the view send_email.rhtml:
Dear <%= @full_name %>,
<%= @message %>
Hope this isn't way too long winded, but is this completely simple to do
without having to store @message as a session variable or in the DB?
Can I just take the value of the textarea, pass it through the
controllers and model to the view like this?
--
Posted via
http://www.ruby-...
.
1 Answer
Logan Capaldo
1/23/2006 2:04:00 AM
0
On Jan 22, 2006, at 8:07 PM, Jason Pfeifer wrote:
> As a noob to Rails and web development in general, I think I still
> need
> a broader understanding of how Views, Controllers, and Models pass
> information and variables to each other.
You probably meant to post this on the rails list:
http://www.ruby-forum.c...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
sending email body text based on form content
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password