# How Routing Rails?

**URL:** <https://www.ruby-forum.com/t/how-routing-rails/90298>\
**Category:** Ruby\
**Created:** [March 27, 2007, 3:48pm UTC](https://www.ruby-forum.com/t/how-routing-rails/90298 "2007-03-27T15:48:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jamal](https://www.ruby-forum.com/u/jamal)\
**Post date:** [March 27, 2007, 3:48pm UTC](https://www.ruby-forum.com/t/how-routing-rails/90298/1 "2007-03-27T15:48:30Z")

</div>

Hello,

I’m trying to do develop some modules so I can reuse all my codes in  
different projects.

I need to put routing in different files, and in route.rb include the  
files which have my routing code, but I don’t know if this would work?

Example, the following lines is inside route\_account.rb.

map.login ‘login’, :controller =\> ‘accounts’, :action =\> ‘login’  
map.login ‘signup’, :controller =\> ‘accounts’, :action =\> ‘signup’  
map.logout ‘logout’, :controller =\> ‘accounts’, :action =\> ‘logout’  
map.account ‘account’ :controller =\> ‘accounts’, :action =\> ‘account’

I tried to include the line below in route.rb, but that wouldn’t work?

include ‘route\_account.rb’  
or load ‘route\_account.rb’ or require ‘route\_account’

Any help would be appropriated 🙂 and thanks

Regards,  
Jamal

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jamal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jamal](https://www.ruby-forum.com/u/jamal)\
**Post date:** [March 27, 2007, 3:51pm UTC](https://www.ruby-forum.com/t/how-routing-rails/90298/2 "2007-03-27T15:51:30Z")

</div>

Yamal Khaled Soueidan wrote:

> map.login ‘login’, :controller =\> ‘accounts’, :action =\> ‘login’
> 
> Regards,  
> Jamal
> 
> Thanks for your help!

> **[Ruby on Rails](https://rubyonrails.org)**
>
> A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

–  
Phillip “CynicalRyan” Gawlowski

Rule of Open-Source Programming #15:

If you like it, let the author know. If you hate it, let the author  
know why.

---

<div class="post-metadata">

**Author:** ![jamal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jamal](https://www.ruby-forum.com/u/jamal)\
**Post date:** [March 28, 2007, 2:34am UTC](https://www.ruby-forum.com/t/how-routing-rails/90298/3 "2007-03-28T02:34:38Z")

</div>

When you just have the lines in route\_account.rb, what do you think  
that “map” refers to?

1. How Kernel#load, Kernel#require work. They do not simply “insert  
text” from the supplied file. Rather, they will execute (effectively,  
anyway)
2. What does “map” mean? It needs to be an instance of  
Action::Controller::Routes, either though a block or a constructor.

This is really the wrong list, though. You should try  
[http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk) for questions like  
this.
