Rails 3 - Using link_to but adding a # for AJAX Deep Linking
Currently my links in Rails are using link_to as follows:
<%= link_to project.name, pro开发者_开发知识库ject %>
Which makes something like: <a href="/projects/1">Project 1</a>
I'm working to implement an AJAX app with deep linking so instead of the above, I want the output to be (with a #): <a href="#/projects/1">Project 1</a>
Is there a way to get this to work with link_to? Or do I need some type of custom helper so I can use something like link_deep_to
Thanks
I recommend instead of <a href="#/projects/1">Project 1</a>
to have
<a href="/projects/1" class="deep_linker">Project 1</a>
And then use jQuery to attach to all links with class of deep_linker. That way your javascript is unobtrusive.
精彩评论