On Fri, Jul 8, 2011 at 1:21 PM, Paul <[email protected]> wrote: > I'd like to rewrite a URL that is passed to me by turning the > parameter into an anchor tag. In other words, if the user requests: > > /my_controller?q=123 > > Does the user click on a link that contains the above URL?
-Conrad > I will handle it in the index action, but I want the user's browser to > show this URL instead: > > /my_controller#123 > > I know I could redirect to a different action. The following works: > > def index > # do stuff > end > > def query > anchor = params[:q] > redirect_to(:action => 'index', :anchor => anchor) > end > > Now if the user requests: > > /my_controller/query?q=123 > > Their browser will say: > > /my_controller#123 > > but how do I do it if I'm already in the correct action? > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

