# \[n00b\] How to do "direct action" URL =\> code, no render?

**URL:** <https://www.ruby-forum.com/t/n00b-how-to-do-direct-action-url-code-no-render/118071>\
**Category:** Rails\
**Created:** [October 23, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/n00b-how-to-do-direct-action-url-code-no-render/118071 "2007-10-23T18:22:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@olie](https://www.ruby-forum.com/u/olie)\
**Post date:** [October 23, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/n00b-how-to-do-direct-action-url-code-no-render/118071/1 "2007-10-23T18:22:27Z")

</div>

I’m not sure if Rails has this – in other frameworks, it’s called  
“direct action” – the idea being that a URL request triggers some code  
to run, but doesn’t result in a web-page being displayed.

So, for example, I might have a cron job that does:

wget [myApp.domain.com/email\_stats](http://myApp.domain.com/email_stats)

which triggers a notifier to send me email with some database  
statistics, but I don’t want it to bother downloading a page.

I _could_ do

wget [myApp.domain.com/email\_stats](http://myApp.domain.com/email_stats) \> /dev/null

but that strikes me as cleaning up the mess after I make it, rather than  
not making the mess in the first place. So what I’m looking for is some  
sort of

render =\> nil

or whatever that I can put at the end of my action to make it not render  
a page.

Is that possible?

Thanks!

---

<div class="post-metadata">

**Author:** ![olie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@olie](https://www.ruby-forum.com/u/olie)\
**Post date:** [October 23, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/n00b-how-to-do-direct-action-url-code-no-render/118071/2 "2007-10-23T18:33:27Z")

</div>

There has to be some response, or you’ll be violating the HTTP  
protocol. However, that can be an empty string.

render :layout =\> false, :text =\> “”

that MIGHT work – I have not tried the code. 🙂

–Michael

---

<div class="post-metadata">

**Author:** ![olie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@olie](https://www.ruby-forum.com/u/olie)\
**Post date:** [October 23, 2007, 8:54pm UTC](https://www.ruby-forum.com/t/n00b-how-to-do-direct-action-url-code-no-render/118071/3 "2007-10-23T20:54:03Z")

</div>

On 23 Oct 2007, at 17:22, Olie D. wrote:

> which triggers a notifier to send me email with some database  
> sort of
> 
> render =\> nil

render :nothing =\> true

Fred
