# Create route for external file using get with no controller

**URL:** <https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174>\
**Category:** Rails\
**Created:** [January 6, 2010, 9:35pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174 "2010-01-06T21:35:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [January 6, 2010, 9:35pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174/1 "2010-01-06T21:35:20Z")

</div>

I created a special flash file that will read tag cloud variables from  
an external text file which will be located in the same directory as the  
swf. The tags are kept in the database and once per day a  
definitions.txt file is created with the population of the tags, the  
ref, and the weight.

My swf file and the external file called definitions.txt are located in  
public\swf.

The swf will call a method of get and need to be able to retrieve the  
data from that file. How can I create a named route in routes.rb to  
accomplish this without a controller present for this action?

public\swf\example.swf  
public\swf\definitions.txt

example.swf will attempt to load definitions.txt from the same directory

Any help would be appreciated. I thought I was pretty savvy with routes  
but I’ve hit a brick wall.

Thanks.

---

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [January 6, 2010, 9:45pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174/2 "2010-01-06T21:45:51Z")

</div>

On Jan 6, 3:35Â pm, Alpha B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## data from that file. Â How can I create a named route in routes.rb to Thanks.
> 
> Posted viahttp://www.ruby-forum.com/.

This isn’t what rails routing does (half of routing is pointless here,  
as with a sane setup the request never even hits the rails app).

If you only want a handy method of linking to the text file from your  
app, just create a helper method or a constant.

---

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [January 6, 2010, 10:00pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174/3 "2010-01-06T22:00:29Z")

</div>

pharrington wrote:

> On Jan 6, 3:35Â pm, Alpha B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > ## data from that file. Â How can I create a named route in routes.rb to Thanks.
> > 
> > Posted viahttp://www.ruby-forum.com/.
> 
> This isn’t what rails routing does (half of routing is pointless here,  
> as with a sane setup the request never even hits the rails app).
> 
> If you only want a handy method of linking to the text file from your  
> app, just create a helper method or a constant.

I don’t need a link. I need a route. There is no link. No one is  
clicking any link on any page. The SWF is embedded on the page. The  
SWF is attempting to pull data from a text file in its root directory.  
If it can be done with a helper method - great, how?

If not, I’m back to square one and need someone to answer my question.

---

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [January 6, 2010, 10:12pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174/4 "2010-01-06T22:12:12Z")

</div>

On Wed, Jan 6, 2010 at 12:35 PM, Alpha B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> data from that file. How can I create a named route in routes.rb to  
> accomplish this without a controller present for this action?

This really has nothing to do with the Rails or Rails routing system.  
If  
you’re  
wanting to simply do the following:

a) pull data from the db  
b) store this date into a file  
c) read this data via ActionScript

If my understanding is correct, you can write a simply Ruby script to  
pull  
the  
information from the db and write it out to a file. Next, is this file  
being created  
at a particular interval? If so, you can use cron to call this script.  
It’s not clear  
from your initial e-mail as to when you’ll be creating this new file.

-Conrad

---

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [January 6, 2010, 10:13pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174/5 "2010-01-06T22:13:22Z")

</div>

On Jan 6, 4:00Â pm, Alpha B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > If you only want a handy method of linking to the text file from your  
> > app, just create a helper method or a constant.
> 
> I don’t need a link. Â I need a route. Â There is no link. Â No one is  
> clicking any link on any page. Â The SWF is embedded on the page. Â The  
> SWF is attempting to pull data from a text file in its root directory.  
> If it can be done with a helper method - great, how?
> 
> ## If not, I’m back to square one and need someone to answer my question.
> 
> Posted viahttp://www.ruby-forum.com/.

Ok. The text file’s in the app’s /public directory… you don’t need a  
route. That is what /public is for; a directory to serve static files  
directly via the web server, _bypassing_ your app. Just access it from  
your swf like you would any other resource thats in /public.

---

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [January 6, 2010, 10:15pm UTC](https://www.ruby-forum.com/t/create-route-for-external-file-using-get-with-no-controller/181174/6 "2010-01-06T22:15:18Z")

</div>

pharrington wrote:

> On Jan 6, 4:00Â pm, Alpha B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > If you only want a handy method of linking to the text file from your  
> > > app, just create a helper method or a constant.
> > 
> > I don’t need a link. Â I need a route. Â There is no link. Â No one is  
> > clicking any link on any page. Â The SWF is embedded on the page. Â The  
> > SWF is attempting to pull data from a text file in its root directory.  
> > If it can be done with a helper method - great, how?
> > 
> > ## If not, I’m back to square one and need someone to answer my question.
> > 
> > Posted viahttp://www.ruby-forum.com/.
> 
> Ok. The text file’s in the app’s /public directory… you don’t need a  
> route. That is what /public is for; a directory to serve static files  
> directly via the web server, _bypassing_ your app. Just access it from  
> your swf like you would any other resource thats in /public.

Thanks mate. This is what I didn’t realize.

I moved the file definitions.txt to public\ and everything is working  
fine now.

I appreciate the clarification.
