logo       

[Rails] Re: path from db as string not evaluated: msg#03230

RubyonRailsTalk

Subject: [Rails] Re: path from db as string not evaluated


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 Strunk 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:
> <a onclick="new Ajax.Updater('contentBody', 'users_path',
> {asynchronous:true, evalScripts:true, method:'get'}); return false;"
> href="#">Users</a>
>
> Does anyone know how to evaluate that users_path so it's /users instead?

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise