Mike Zornek on 2 Mar 2007 04:26:14 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] Calling a helper based on dynamically created string

You know how when you are using the new resource features in Rails 1.2 it
will create all these helper methods for you. Like if I had a resource for
my `Comment` class I'd get `comments_url`, `comments_path`,
`comment_path(1)`, etc. Well let's say I'm trying to dry up my views -- some
of these crud pages are just very repetitive -- how do I call a helper based
on a string I create. I'd like to create a string like
`object.class.to_s.downcase.pluralize + '_url' and then call that helper.
How can I do this?

~ Mike
Work: http://ClickableBliss.com
Play: http://MikeZornek.com

To unsubscribe or change your settings, visit: