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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:25:11+00:00 2026-05-18T11:25:11+00:00

I have a Rails app (2.3.8) where I send emails using ActionMailer from my

  • 0

I have a Rails app (2.3.8) where I send emails using ActionMailer from my Controllers, with no problems.

However, I´ve created a rake task to be called from a Cronjob (in Heroku). When those emails are sent, no locale transformations in my dates are made.

I´ve googled to find any kind of solution, but couldn´t.

Anyone can help me?

Thanks.

Here is the code:

cron.rake:

desc 'This task is called by the Heroku cron add-on'  
task :cron => :environment do  
puts 'Sending diary...'  
hollydays = [6,0] #weekend    
unless hollydays.member?(Time.zone.now.wday) #if is NOT a weekend   
 User.all.each do |user|  
   user.deliver_task_diary
 end  
end  
puts 'done.'  
end  

user model method:

def deliver_task_diary
  TaskMailer.deliver_task_diary(self)
end

the method in TaskMailer model:

def task_diary(user)
  next_five_tasks = user.next_five_tasks
  last_five_tasks = user.last_five_tasks

  recipients "#{user.name} <#{user.email}>"
  from       "My site <no_reply@mysite.com>"
  subject    "Your daily tasks."
  sent_on    Time.zone.now
  body       :user => user, :next_five_tasks => next_five_tasks, :last_five_tasks => last_five_tasks

end

part of my email template that doesn´t locale:

<%=l task.estimated_delivery_date, :format => :short %>
  • 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-18T11:25:12+00:00Added an answer on May 18, 2026 at 11:25 am

    Solved.

    I don´t know if it´s the best way, but I´ve just declared the locale at the very beging of the email html template:

    <% I18n.locale = "pt-BR" %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble sending mail using SMTP from a Rails app. I have a
I have a Rails app that needs to send out emails with a particular
I'd like to send plain text emails from a Rails app. In my mail
I was using only html emails which worked from my Rails 3.1.4 app, but
I have a Rails app that is served by Apache and Passenger, using only
I have a rails app set up as an OAuth2 provider (using Doorkeeper). The
I have a rails app with Devise 1.4.9. Currently, it allows only users from
I have a simple rails app where user can send a mass email to
I have a rails app that has approx 30 matches in routes.rb match '/send-email'
I'm using a Chrome extension to send data to my Rails app (the staged_images

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.