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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:39:56+00:00 2026-06-04T22:39:56+00:00

Eventually I would like to get to setting it up as a Rake task

  • 0

Eventually I would like to get to setting it up as a Rake task and do a cron job, but for right now…all I want to do is take my ruby script that used to work as a standalone script and have it work within my Rails app.

I renamed the file to be .rake instead of .rb and tried doing rake my_script at the command-line, but that gave me this error message:

rake aborted!
Don't know how to build task 'my_script'

(See full trace by running task with --trace)

How do I run this script within my Rails environment?

This is the first time I am doing something like this, so any assistance would be greatly appreciated.

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-04T22:39:58+00:00Added an answer on June 4, 2026 at 10:39 pm

    The primary difference between a runner and a rake task is : runner would boot rails while rake task doesn’t (you can tell it to do so).

    Since rake can do both (boot/no boot), there’s no concept of runner in rails-3 anymore.

    So, create a rake task: whatever_name.rake

    Example:

    desc "This task does awesome stuff"
      task :do_awesome_stuff do
      awesome_method
    end
    
    def awesome_method
      #put your ruby code here
    end
    

    Now from your command prompt, type rake do_awesome_stuff to execute this rake task.

    To make it boot Rails, change task definition to this:

    task :do_awesome_stuff => :environment do
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a web application and eventually would want to use Yii framework. But
This seems like a simple and common task, but we cannot get it to
Eventually, our team would like to move away from tables, but it seems like
I like operating systems and would eventually like to become a OS developer mostly
I would like to run a shell command and get its output in clickable
I'm new to this sort of thing, but I would like to create a
I am thinking of making an (initially) small Web Application, which would eventually have
My program eventually consumes all ram and crashes... looking through the code, I can't
I'd like to eventually publish one of the iPhone projects I've been working on
I know the title isn't informative at all, but I had no idea how

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.