On Oct 22, 2009, at 5:04 PM, Robb wrote:
> On Oct 22, 11:47 am, sax <[email protected]> wrote:
>> weather_report_url(:location => 'france', :month => 10, :day => 3)
>
> Ummhmm, I can grab out the attributes of my Report object. And I guess
> I can use that with link_to in a template:
>
> link_to('the report', weather_report_url(:location => @loc, :month
> => r.month, :day => r.day))
>
> ...I was hoping to get to something more like:
>
> link_to('the report', @loc, r)
You'll never get it quite that simple unless you write your own helper.
module MyHelper
def weather_link_to(text, location, report, options={})
link_to(text, weather_report_path(:location => location,
:month => report.month,
:day => report.day),
options)
end
end
<%= weather_link_to('the report', @loc, r) %>
-Rob
Rob Biedenharn http://agileconsultingllc.com
[email protected]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---