DRY up link_to_remote and its url_for

In an attempt to provide a gracefully degradable link_to_remote, I
repeat myself every time:
<%= link_to_remote(‘Signup’,
{:url => {:controller => ‘user’, :action => ‘signup’}},
{:href => url_for(:controller => ‘user’, :action => ‘signup’)}) %>

Looked around the RDoc & this forum, I couldn’t see anything obvious.
Without specifying the :href, I will get a “#” for href. Anything out
there that is able to DRY the above code?

TIA!

As a simple solution, you could just create your own helper…

def link_to_both text, options
link_to_remote text, options, :href => url_for( options[:url] )
end

link_to_both ‘Signup’, :url => { :controller => ‘user’, :action =>
‘signup’
}

mark

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs