Ian Purton

Ian Purton’s Notes

'rails' Category

  • Helper to Display Rails Flash Messages

    A simple code snippet for displaying your flash[:warning] = “Warning Message” messages in rails.

  • Simple Email Send Function In Ruby

    If you need to send an e-mail in ruby, this little function works well.

    def send_email(from, from_alias, to, to_alias, subject, message)

    msg = <<END_OF_MESSAGE
    From: #{from_alias} <#{from}>
    To: #{to_alias} <#{to}>
    Subject: #{subject}

    #{message}
    END_OF_MESSAGE

    Net::SMTP.start(’localhost’) do |smtp|
    smtp.send_message msg, from, to
    end

    end

Subtraction Wordpress Theme by Ian Purton