Hi, Is there a way to specify keys of a hash in params to filter_parameter_logging. For example, my payment form sends creditcard[:number] and creditcard[:type] in params and I filter these keys using filter_parameter_logging :number, :type. I don''t want :number and :type in other forms to be filtered. Is there a way to solve this? thanks, Ritesh --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
ritesh wrote:> Hi, > > Is there a way to specify keys of a hash in params to > filter_parameter_logging. > > For example, my payment form sends creditcard[:number] and > creditcard[:type] in params and I filter these keys using > filter_parameter_logging :number, :type. > > I don''t want :number and :type in other forms to be filtered. Is there > a way to solve this? > > thanks, > RiteshThis condition is more advanced that filter_parameter_logging is designed to handle. You''ll need to define your own filter_parameters method for the controller. Here''s an example that may work for you: def filter_parameters(unfiltered) return unfiltered unless params[:action] == ''payment'' filtered = unfiltered.dup filtered[:creditcard] = unfiltered[:creditcard].dup filtered[:creditcard][:number] = ''[FILTERED]'' filtered[:creditcard][:type] = ''[FILTERED]'' filtered end Jeremy -- 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?hl=en -~----------~----~----~----~------~----~------~--~---