Absolute URLs


#1

Hey, is there a way I can get link_to to spit out absolute URLs,
rather than relative URLs? I would like to do this for SEO purposes.
Is there something that I have to subclass to get this to go, or is
there a better hack out there to do this.

Thanks!

Kevin


#2

Kevin McCarthy wrote:

Hey, is there a way I can get link_to to spit out absolute URLs,
rather than relative URLs? I would like to do this for SEO purposes.
Is there something that I have to subclass to get this to go, or is
there a better hack out there to do this.

Thanks!

Kevin

If you are using named routes you can just used named_route_url instead
of named_route_path.

Or: link_to :action => ‘index’, :only_path => false

Or I think you can add this method to application.rb

def default_url_options
{ :only_path => false }
end