# Path from db as string not evaluated

**URL:** <https://www.ruby-forum.com/t/path-from-db-as-string-not-evaluated/161978>\
**Category:** Rails\
**Created:** [March 4, 2009, 1:21pm UTC](https://www.ruby-forum.com/t/path-from-db-as-string-not-evaluated/161978 "2009-03-04T13:21:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [March 4, 2009, 1:21pm UTC](https://www.ruby-forum.com/t/path-from-db-as-string-not-evaluated/161978/1 "2009-03-04T13:21:22Z")

</div>

Hey,

my menu is stored in the database like that:  
name path  
Home root\_path  
Users users\_path

and I create the links with link\_to\_remote:  
\<%= link\_to\_remote navigation.name,  
:url =\> navigation.target,  
:update =\> ‘contentBody’,  
:method =\> :get %\>

The problem is when I load page it looks like:  
Users

Does anyone know how to evaluate that users\_path so it’s /users instead?

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [July 31, 2009, 11:40am UTC](https://www.ruby-forum.com/t/path-from-db-as-string-not-evaluated/161978/2 "2009-07-31T11:40:38Z")

</div>

Hy!

I have a same problem and I think the to\_sym method is the solution.  
If you would insert users\_path into he link\_to attributes, you need  
“users”.to\_sym.

Examples:  
“new\_user”.to\_sym =\> new\_user\_path  
“root”.to\_sym =\> root\_path

And it’s work.

Sorry for my bad english.

Heinz S. wrote:

> Hey,
> 
> my menu is stored in the database like that:  
> name path  
> Home root\_path  
> Users users\_path
> 
> and I create the links with link\_to\_remote:  
> \<%= link\_to\_remote navigation.name,  
> :url =\> navigation.target,  
> :update =\> ‘contentBody’,  
> :method =\> :get %\>
> 
> The problem is when I load page it looks like:  
> Users
> 
> Does anyone know how to evaluate that users\_path so it’s /users instead?
