# Another quick question, or two

**URL:** <https://www.ruby-forum.com/t/another-quick-question-or-two/168513>\
**Category:** Rails\
**Created:** [May 21, 2009, 6:28pm UTC](https://www.ruby-forum.com/t/another-quick-question-or-two/168513 "2009-05-21T18:28:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 21, 2009, 6:28pm UTC](https://www.ruby-forum.com/t/another-quick-question-or-two/168513/1 "2009-05-21T18:28:57Z")

</div>

If I want to link from/redirect via the index page (which I notice will  
not process as erb), what’s the local relative path I should use to the  
the view (object/method don’t work)?

I am getting to like rails so I will probably stick with it. Does  
anyone have anything to say (pro and contra, please) about the various  
“Ruby on Rails” books that are available?

---

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 21, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/another-quick-question-or-two/168513/2 "2009-05-21T18:35:07Z")

</div>

Mk 27 wrote:

> If I want to link from/redirect via the index page (which I notice will  
> not process as erb)

Huh? _What_ won’t process as ERb?

> , what’s the local relative path I should use to the  
> the view (object/method don’t work)?

Let Rails build the path for you. Take a look at url\_for and/or named  
routes. It’s uncommon to need to specify literal URLs in a Rails app.

> I am getting to like rails so I will probably stick with it.

Cool!

> Does  
> anyone have anything to say (pro and contra, please) about the various  
> “Ruby on Rails” books that are available?

Even though many of the books out there seem to be excellent, book  
publishing moves slowly, and Rails core development moves very fast, so  
books can get obsolete pretty quickly.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 21, 2009, 8:15pm UTC](https://www.ruby-forum.com/t/another-quick-question-or-two/168513/3 "2009-05-21T20:15:30Z")

</div>

Marnen Laibow-Koser wrote:

> Mk 27 wrote:
> 
> > If I want to link from/redirect via the index page (which I notice will  
> > not process as erb)
> 
> Huh? _What_ won’t process as ERb?

public/index.html

I copied my (working) application.html.erb from app/layouts, made some  
appropriate modifications, and named it “index.html.erb”. When I start  
the server and go to localhost:3000, it does read the page but it spits  
out the \<%ruby%\> unparsed, like I suppose it would if I used apache.

Anyway, I am sure I will get to know all the rails commands eventually,  
but since all the paths are absolute relative to one another, I would  
actually PREFER to know what they are/should be – you cannot get  
simpler than typing a relative url, eg. it would literally be  
“app/views/section/list” (although this does not work). Ease of use is  
one thing, pointless opacity is another.

So, can I ask that question again in the hopes of getting a real answer?  
I will investigate url\_for and routes as well…

---

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 21, 2009, 8:46pm UTC](https://www.ruby-forum.com/t/another-quick-question-or-two/168513/4 "2009-05-21T20:46:39Z")

</div>

Marnen Laibow-Koser wrote:

> Learn how routing works in Rails (the rdoc is excellent on this topic).  
> That’s the only real answer that I or anyone else can give you.

Okay…thanks for the explanation

---

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 21, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/another-quick-question-or-two/168513/5 "2009-05-21T20:29:22Z")

</div>

Mk 27 wrote:

> Marnen Laibow-Koser wrote:
> 
> > Mk 27 wrote:
> > 
> > > If I want to link from/redirect via the index page (which I notice will  
> > > not process as erb)
> > 
> > Huh? _What_ won’t process as ERb?
> 
> public/index.html

Right. The public directory is for static assets. If you want a  
dynamic index page, then use map.root in routes.rb.  
[…]

> Anyway, I am sure I will get to know all the rails commands eventually,  
> but since all the paths are absolute relative to one another, I would  
> actually PREFER to know what they are/should be – you cannot get  
> simpler than typing a relative url, eg. it would literally be  
> “app/views/section/list” (although this does not work).

This is a bad idea. I know it may seem simpler, but it really isn’t.  
The reason is that Rails controls URL mapping through the routes.rb  
file, so the URLs are not necessarily directly related to the object  
structure of the application. Specifying literal URLs will bypass a lot  
of the routing logic, which is generally not what you want.

> Ease of use is  
> one thing, pointless opacity is another.

This is not pointless opacity. It exists so you can provide nice URLs  
to your users without having to expose implementation details that users  
shouldn’t see.

> So, can I ask that question again in the hopes of getting a real answer?

Learn how routing works in Rails (the rdoc is excellent on this topic).  
That’s the only real answer that I or anyone else can give you.

> I will investigate url\_for and routes as well…

Please do.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
