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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:17:12+00:00 2026-06-09T16:17:12+00:00

Should I apply the ruby convention when a method can be destructive and add

  • 0

Should I apply the ruby convention when a method can be destructive and add a bang(‘!’) to the rake task name OR do I conform more to unix type standards and hence my personal understanding is that a bang is not often used.

eg. which is better?

$ rake update_products   # OR
$ rake update_products!

Background

I have a method which pulls product data from an external API and updates records in my system with the newly imported data for each product.

The method is called like so:

e = ExternalConnection.new
e.update_products!

Im creating a rake task so I can use this in a cron job/heroku scheduler.

# scheduler.rake
task :update_products => :environment do
    e = ExternalConnection.new
    e.update_products!
  • 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-09T16:17:14+00:00Added an answer on June 9, 2026 at 4:17 pm

    It’s up to you and if you want to follow the conventions. Is the update_products method going to modify the e object? If so, we could say that this is a “dangerous method” because the e state is going to change, and maybe somebody else depends on that object.

    I, personally would add the “!”. Why? Because if another (Ruby) programmer is going to play with the code, he will be like “oh hold on, let’s be careful with this”.

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

Sidebar

Related Questions

This is in the context of a Dojo editor, but it should apply more
How can I redirect someone who types http://domain.com/+abc (this should only apply to alphanumeric
Can I teach Notepad++ that it should apply a fold whenever it sees a
Can anyone guess what CSS styling I should apply to a button to guess
When using english the following URL should apply: http://example.org/services/myservice/ When using another language, the
I have a 2-class dataset on which I should apply a binary classification algorithm.
The precedence section in chapter 9.3.1 tells me that I should apply the special
I came across this question on transcender: What should you apply to a field
I'm wondering whether I should create extension methods that apply on the object level
I have a media section in http://androdevlab.com/style.css that should apply to http://androdevlab.com when view

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.