How do you accomplish page navigation with link_to. In other words I want some way for <%= link_to ... %> to output, <a href="<%RAILS_ROOT%>/controller/action#PAGE_NAV">Name</a> Is this possible? Best, Sam -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can specify an anchor in any _to functions with :anchor. Like so: <%= link_to "Name", :controller => ''controller'', :action => ''action'', :anchor: ''PAGE_NAV'' %> You may also want to set :skip_relative_url_root to false if you need the root explicitly set. j On Aug 14, 9:23 am, Sam Woodard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> How do you accomplish page navigation with link_to. In other words I > want some way for <%= link_to ... %> to output, > > <a href="<%RAILS_ROOT%>/controller/action#PAGE_NAV">Name</a> > > Is this possible? > > Best, > Sam > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hi sam, you can do this as joshua said, and some other methods, may be like this 1) writer your on helper, some thing like this, (you can send what ever extra options you want and handle it here,) def my_link_to_function(options) "<a href=''#{RAILS_ROOT}/#{options[:url]}''> #{options[:display_text]} </a>" end 2) one more options is that link_to internally uses content_tag so you can pass directly pass :href options to link_to. (may be this leads to a kind of hard coding) P.s: sorry, if i din''t answer to your point. On Aug 14, 9:23 pm, Sam Woodard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> How do you accomplish page navigation with link_to. In other words I > want some way for <%= link_to ... %> to output, > > <a href="<%RAILS_ROOT%>/controller/action#PAGE_NAV">Name</a> > > Is this possible? > > Best, > Sam > -- > Po sted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---