# Running a rake task from a controller (pass/return values)

**URL:** <https://www.ruby-forum.com/t/running-a-rake-task-from-a-controller-pass-return-values/132052>\
**Category:** Ruby\
**Created:** [March 16, 2008, 3:01am UTC](https://www.ruby-forum.com/t/running-a-rake-task-from-a-controller-pass-return-values/132052 "2008-03-16T03:01:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harpoon45](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/53a042/32.png) [@harpoon45](https://www.ruby-forum.com/u/harpoon45)\
**Post date:** [March 16, 2008, 3:01am UTC](https://www.ruby-forum.com/t/running-a-rake-task-from-a-controller-pass-return-values/132052/1 "2008-03-16T03:01:43Z")

</div>

I’m a RoR noob.  
I have a controller that receives data from a view. I want to save that  
data into a DB, which is fine. After saving the data, I want to run a  
rake task on it to get more data to save it in the DB.

The rake task work fine, but I can’t figure out a way to pass in the  
recordID for the task I want the task to run on.

Within the rake task I can access all the data within a table and run  
the task on all the data, but I don’t want that to happen. All I want is  
to pass in the recordID for the task to run on .

Also, is there a way for a rake task to return an array back to the  
controller?

---

<div class="post-metadata">

**Author:** ![harpoon45](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/53a042/32.png) [@harpoon45](https://www.ruby-forum.com/u/harpoon45)\
**Post date:** [March 31, 2008, 2:45am UTC](https://www.ruby-forum.com/t/running-a-rake-task-from-a-controller-pass-return-values/132052/2 "2008-03-31T02:45:18Z")

</div>

Wow…

It’s like a bundle of mixedupness! 🙂

Can I ask why you’re using a rake task?

Better to clarify what you’re talking about first, then we can help out.

Julian.
