Yeah I think this would be the way to do it. A helper is really suited for stuff like this.
On 18/09/2011, at 21:49, Dan Cheail <[email protected]> wrote: > >> Say I was building Github (I'm not!), I'd really just like to link_to @repo >> rather than every time having to specify link_to [@repo.owner, @repo]. >> That's not too much to ask is it? > > What about a simple helper? > > # app/helpers/application_helper > module ApplicationHelper > def link_to_repo(caption, repo) > link_to caption, [repo.owner, repo] > end > end > > <%= link_to_repo(@repo) %> > > Simple, straight-forward, no magic. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" 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/rails-oceania?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" 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/rails-oceania?hl=en.
