Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7417057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:37:26+00:00 2026-05-29T07:37:26+00:00

Problem I have an app where one can make pledges against a gift. Once

  • 0

Problem

I have an app where one can make pledges against a gift. Once a pledge is made, an email confirmation should be sent to pledger. Server is issuing 500 Internal Server Error when attempting to mail.

Context:

  • Ruby on Rails 3.2.0
  • Actionmailer 3.2.0
  • Mongoid 2.4.3
  • Thin 1.3.1

I’ve used Actionmailer on previous apps, but this is my first time working with Mongoid.

Code

class Pledge
  include Mongoid::Document
  field :name, :type => String
  field :email, :type => String
  field :amount, :type => Float

  embedded_in :gift
end 


class PledgesController < ApplicationController
  def create
    @gift = Gift.find(params[:gift_id])
    @pledge = @gift.pledges.new(params[:pledge])

    respond_to do |format|
      if @pledge.save
        PledgeMailer.pledge_confirmation(@pledge).deliver
        format.html { redirect_to :root, notice: 'Pledge successfully created.' }
      else
        ...
      end
    end
  end
...
end


class PledgeMailer < ActionMailer::Base
  default :from => "no-reply@mail.com"

  def pledge_confirmation(pledge)
    @pledge = pledge
    mail(:to => pledge.email, :subject => "Thanks - pledge confirmation")
  end
end

Log

So let’s say Sam Andreas at sacrificial.address@gmail.com pledged $42.42 for gift 4f2695009f5b7f3464000001.

This happily saves to Mongodb and redirects to :root. With adding the call to PledgeMailer, we get:

Started POST "/gifts/4f2695009f5b7f3464000001/pledges" for 127.0.0.1 at 2012-02-08 14:13:21 +1100
Processing by PledgesController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"EwgOwALSb8uUsT4Ow1+RBvAEihXKXoqKS1JA9ZfpUfg=", 
    "pledge"=>{"name"=>"Sam Andreas", "email"=>"sacrificial.address@gmail.com", "amount"=>"42.42"}, 
    "commit"=>"Create Pledge", "gift_id"=>"4f2695009f5b7f3464000001"}
  MONGODB danspressie_development['gifts'].find({:_id=>BSON::ObjectId('4f2695009f5b7f3464000001')}).limit(-1).sort([[:_id, :asc]])
  MONGODB danspressie_development['gifts'].update({"_id"=>BSON::ObjectId('4f2695009f5b7f3464000001')}, {"$push"=>{"pledges"=>{"_id"=>BSON::ObjectId('4f31e8519f5b7f41d1000002'), "name"=>"Sam Andreas", "email"=>"sacrificial.address@gmail.com", "amount"=>42.42}}})
  Completed 500 Internal Server Error in 11ms

SyntaxError (/Users/daniel/Dropbox/dev/src/danspressie/app/mailers/pledge_mailer.rb:4: invalid multibyte char (US-ASCII)
/Users/daniel/Dropbox/dev/src/danspressie/app/mailers/pledge_mailer.rb:4: syntax error, unexpected $end, expecting keyword_end 
  def pledge_confirmation(pledge)
 ^):
  app/controllers/pledges_controller.rb:8:in `block in create'
  app/controllers/pledges_controller.rb:6:in `create'

Struggling hard, but can’t see where the error is in pledge_confirmation.

Do you have any pointers? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:37:27+00:00Added an answer on May 29, 2026 at 7:37 am

    Your code looks fine. The error is complaining about an “invalid multibyte char (US-ASCII)”. You’d better recreate pledge_mailer.rb from scratch and save it with charset UTF-8 instead of US-ASCII.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make an app which have one panoramic image, and when I
Problem: We have a web app that calls some web services asynchronously (from the
I have problem in declaring the intents on my app. I have a form
I have problem with Timeout, when I run a command through app, a timeout
I'm writing an app in Visual Studio C++ and I have problem with assigning
I am building my first ASP.Net MVC based app and have a problem accessing
I'm developing small FTP upload app. for mac (10.6 if it matters) Have problem
Problem 1: I have a simple winforms app and I want to DataBind my
I have big problem when I am trying to deploy my app over clickonce.
i still have a problem to develop a convenient app to the user. because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.