kala-tamin Rails routing and URI fragment identifier


Rails routing and URI fragment identifier



When I was developing my RoR skills with some basic tutorials I encountered a problem. What I am trying to achieve is having comments belonging to posts, with no separate index or individual view. This part was easy.

Here comes tough one. I want post_comment_url to return address with fragment identifier: http://example.com/posts/2#comment-4. It would allow me to use redirect_to in it's simplest form, without :anchor parameter (which would be against ruby way of keeping things simple).

How to do that?




Ruby on Rails session storage - how to *not* store certain fields in session store?

1:



JID naming strategy for a bot army?
Instead of altering Rails' default behavior, it'd probably be better to wrap up your needs in a helper method:.
Cucumber: rails dynamic find not working in paths.rb
# in app/controllers/application_controller.rb class ApplicationController   helper :comment_link    def comment_link(comment)     post_comment_url(comment.post, comment, :anchor => "comment-#{comment.id}")   end end 
The call to helper will allow you to access that method in your views as well as your controllers..
Best way to generate slugs (human-readable IDs) in Rails


Make cucumber run migrations instead of schema load


97 out of 100 based on 47 user ratings 997 reviews