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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:50:49+00:00 2026-06-15T13:50:49+00:00

I have a Rails app parsing incoming e-mails on Heroku using the Cloud-mailin add-on.

  • 0

I have a Rails app parsing incoming e-mails on Heroku using the Cloud-mailin add-on. The app recieves a list of prices in an e-mail and inserts them into the database.

This works fine, but if the e-mail contains for instance a signature in the bottom the code fails because it’s also trying to parse that text.

Therefor I would like to rewrite the below parsing code to stop when it hits an empty line in the e-mail. All the price data is always at the top of the e-mail.

email_text = params[:plain]
email_text_array = []

email_text.split("\n").each do |email_line|
    email_text_array << email_line.split(" ")
end 

How do I change the above to stop when it hits an empty line in the email_taxt variable?

Thanks!

  • 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-06-15T13:50:49+00:00Added an answer on June 15, 2026 at 1:50 pm

    You can add a break :

    email_text.split("\n").each do |email_line|
      break if email_line.blank?  # ends loop on first empty line
      email_text_array << email_line.split(" ")
    end 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that is parsing HTML using the nokogiri gem version
I have a Rails app running Mongoid on Heroku and I need to set
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 rails app which has a list of users. I have different relations
I have Rails app with a Postgres backend. I need to add full text
We have a Rails 3 app using session-based authentication (modified acts_as_authenticated), and a Flex
I have rails app which are working perfectly in the local computer. But when
I have a Rails app with the usual application_controller, and a controller (and model)
I have a rails app, where Im having a drop box like feature-set. Each

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.