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 4072948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:56:59+00:00 2026-05-20T16:56:59+00:00

A user can create an object, and he has followers that I want to

  • 0

A user can create an object, and he has followers that I want to alert when he creates this object.

controller:

if @project.save
  format.html { redirect_to(@project, :notice => 'Project was successfully created.') }
  format.xml  { render :xml => @project, :status => :created, :location => @project }
  # Send a notification to project owner's followers :
  UserMailer.new_project(@project).deliver
else
  ...

user_mailer.rb:

def new_project(project)
    @url  = "http://localhost:3000/"
    @project = project
    # For each of project owner's follower, send an email notification
    @followers = project.owner.followers.all
    @followers.each do |f|
        @u = User.find(f.follower)
        mail(   :to => @u.email,
            :from => '"Beatrix Kiddo" <beatrix@example.com>',
            :subject => "#{project.owner.name} created a new project")
    end
end

Testing with a user that has 2 followers:
User.find(1).followers.count = 2

Follower.follower is the id of the user who’s following.

Only 1 email is sent to the 1st follower, and the 2nd doesn’t receive anything – what’s wrong?

[SOLVED] => the .deliver method simply doesn’t support multiple messages. Thx DR

  • 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-20T16:57:00+00:00Added an answer on May 20, 2026 at 4:57 pm

    ActionMailer does not support sending multiple messages with one deliver call.
    You have to move the loop outside of the new_project method:

    Instead of

    UserMailer.new_project(@project).deliver
    

    try this:

    @followers = @project.owner.followers.all
    @followers.each do |f|
        UserMailer.new_project(@project, f).deliver
    end
    

    The new_project method then could look like this:

    def new_project(project, follower)
        @u = User.find(f.follower)
        mail(:to => @u.email,
             :from => '"Beatrix Kiddo" <beatrix@example.com>',
             :subject => "#{project.owner.name} created a new project")
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so im still stuck on this that i can create remote shared object but
On my site a authorized user can create a content type called protocol. This
I have a form on a page that a user can use to create
I want to create previous versions so a user can undo changes made and
A user can create a post. Posts have comments. A comment must belong to
In my application user can create post,however only the creator of the post can
I am building a website templating system where multiple user can create their own
I am writing an application , which User can create Topics and others can
I'm writing an app where a user can both create their own pages for
How can create a New user in ORACLE with full access (alter, delete, select,

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.