Hi, for ActiveRecord, there is the helper "error_messages_for". I would like to extend this, in order to make it possible to spit out validation errors for more than one model object. Where would I have to place my code in order to make the new helper work appropriately? I defined it as a helper for my view, which lead to unwanted behaviour. TIA, Robert -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
well error_messages_for is an ActionView Helper, not an ActiveRecord Helper. so defining your own "version" of it as a helper for your view would be the right way to go. what "unwanted behaviour" did occur ? Maybe show some code how your helper looks right now. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Thorsten L wrote:> well error_messages_for is an ActionView Helper, not an ActiveRecord > Helper. > > so defining your own "version" of it as a helper for your view would be > the right way to go. > > what "unwanted behaviour" did occur ? Maybe show some code how your > helper looks right now.I did something like objects.collect{|o| instance_variable_get("@#{o}")} which always gave me nil as the result for each instance_variable_get - which kind of makes sense because it was a view helper and not a class helper. I''ve got it working though, thanks :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---