My problem is that: I have a web service controller, it has bunch of public methods, each of them has first argument userid, so I implement before_invocation method: def validUser(name, args) begin @user = User.find(args[0]) rescue ActiveRecord::RecordNotFound raise "Wrong user id!" end ... ... end It not only check the userid is valid, it also get the @user object that other methods can directly use. I want to expand it. My methods also use other id arguments, like categaryid, productid. They should also be mapped to ActiveRecord object. But they not necessary used by every method, not always the 2nd or 3rd argument. If in my before_invocation method, I can get the argument name list of each method, then I can know which is the id argument, then I can convert them to ActiveRecord object. Then I do not need to write below code in each methods that has categaryid argument: begin @categary = Categary.find(categaryid]) rescue ActiveRecord::RecordNotFound raise "Wrong categary id!" end Any one can tell me how to do? Jack -- 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 -~----------~----~----~----~------~----~------~--~---