I'm frequently in need of generating a formatted polymorphic url. Currently, it's done ugly because the formatted_polymorphic_url code is broken (see ticket 8782 and Mislav's #2 above). I would like to see that helper working-but if the job can be done with something simpler, I'm all for it. Trevor's suggestion is intriguing -leave the "formatted" prefix off and use the signature to determine if formatting is required. That would be ideal.
On Jan 21, 8:35 pm, "Trevor Squires" <[EMAIL PROTECTED]> wrote: > On 1/21/08, Michael Koziarski <[EMAIL PROTECTED]> wrote: > > > On Jan 22, 2008 9:28 AM, Mislav Marohnić <[EMAIL PROTECTED]> > > wrote: > > > > Should this work: polymorphic_url(@article, :format => :pdf) ? Currently > > it > > > doesn't. I've included a failing tests, it's commented out.OpenActionPack > > > I don't think it should work with these 'advanced' hash arguments. do > > they do the right thing when passing through to the optimised named > > route generators? Do we want to support them going forwards? > > Koz, > I've often wondered why (apart from specific implementation reasons) we need > a formatted_xxx helper to cater for formats at all. > > Bearing in mind that the generated helper code (including optimization > stuff) could just look at the size of the hash and whether it's only member > is :format, is there a reason the generated helpers can't simply distinguish > between these signatures? > > album_path(an_album) > album_path(an_album, :format => :xml) > albums_path() > albums_path(:format => :xml) > > Somehow that seems easier on the eyes than: > > album_path(an_album) > formatted_album_path(an_album, :xml) > albums_path() > formatted_albums_path(:xml) > > I think it's because formatted_ seems to just add noise to the method name. > The format isn't (to me) the most important thing, it's more of an > afterthought. Keeping it's specification exclusively in the params mirrors > that imho. > > Regards, > Trevor > -- > -- > Trevor Squireshttp://somethinglearned.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---