I guess you could try: <%= error_messages_for :author, :object => author %>
- Matt On Thu, Jul 16, 2009 at 11:23 AM, Glenn Little <[email protected]> wrote: > > I'd like to call error_messages_for() in a partial. > error_messages_for at some point does this: > > objects = params.collect {|object_name| > instance_variable_get("@#{object_name}") }.compact > > Basically, it needs to be pointed to an instance variable, not passed > an object itself. However, partials give you local vars, not instance > vars. > > I can explicitly create an instance var like this: > > (in _author.rhtml): > > @author = author > ... > <%= error_messages_for(:author) %> > ... > > But that seems clunky. I'm just wondering if there's a more > rails-approved (tm) idiom for doing this? > > Thanks. > > -glenn > > > > --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---
