Topic: Simple submission issue

This should be very basic for someone here. I am new to Ruby on Rails programming.
I'm trying to make a submission button so that people can enter information and then that information would be sent to my email address at support@glucosebuddy.com

Can anyone provide me with the code to do that? You can find the page at http://beta.glucosebuddy.com/better_diabetes

Re: Simple submission issue

First of all, you should read this:  http://api.rubyonrails.org/classes/Acti … /Base.html

Basically, you will need to create a mailer:
$ script/generate mailer Notifier

Put something like this into app/models/notifier.rb:

class Notifier < ActionMailer::Base
  def notification(recipient, name, email, rant)
    recipients recipient[0].email
    from       user.email
    subject    "New submission"
    body       :name => name, :email => email, :rant => rant
  end
end

You will need to add a page like this under app/views/notifier/notification.erb:
Name: <%= @name %>
Email: <%= @email %>
Rant: <%= @rant %>

In the controller that the form was for, add this something like this to the action your form calls:
#variables are created here
Notifier.deliver_notification(@you, @name, @email, @rant)

Last edited by terrance19 (2009-03-17 14:36:02)

Re: Simple submission issue

Duplicate post - please direct any/all replies to this thread:

http://railsforum.com/viewtopic.php?id=28303