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

  • Home
  • SEARCH
  • 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 have a Rails 3 App using devise. I want to create a User/Profile
I have a rails 3 app that displays user submissions in order of how
I have a standard Rails app that uses a database, sqlite3 and the webrick
i have a rails 3.1rc4 app and i would like to update a div
I have a Rails 2.3 app which tracks an organisation's members, and whether they
I have the directory of a Rails app open in Vim and would like
I'm using Nginx to reverse proxy my Unicorn process for a Rails app that
I have a new web app that is packaged as a WAR as part
I was hoping to make a Rails app usable both as an Engine and
I have a project that adds elements to an AutoCad drawing. I noticed that

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.