From: arjun ghosh Date: 2007-05-07T19:13:04+09:00 Subject: Re: passing by value of object of a model ------=_Part_11128_7604145.1178532782965 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Nanyang, u r correct, my mistake....model name is FoodDept but the string i want to pass is "food_dept". The reason is that there are different dept under a model Dept and FoodDept is an inherited model from it.. now for my app, i need to send different dept to a method for processing and hence i was trying to send the string name. On 5/7/07, Nanyang Zhan wrote: > > I know how to do it for RoR. > If food_dept is a model(class) name,shouldn't it be FoodDept? > if so, you can use this: > "food_dept".camelize.constantize > > if you mean it's a method, use this: > send("food_dept") > > >> class Foo > >> def bar > >> "test" > >> end > >> end > => nil > >> a="foo" > => "foo" > >> b="bar" > => "bar" > >> c = a.camelize.constantize.new > => # > >> c.send(b) > => "test" > > but sadly, it seems this wouldn't work for ruby. > > > > -- > Posted via http://www.ruby-forum.com/. ------=_Part_11128_7604145.1178532782965--