Abhinav Saxena wrote:
> Hi,
>
> Can you put in a statement what you are trying to do, probably then I
> (and
> others) will be able to help you better.
>
> --
> Thanks,
> Abhinav
> http://twitter.com/abhinav
>
>
>
> On Thu, Sep 3, 2009 at 3:19 PM, Ahmet Kilic <
thanks,
I improved my code, but still not enough
its giving me double result
def find_class(class_name, stack = [])
puts(("\t" * stack.size) + class_name)
stack.push class_name
FileClass.find(:all, :conditions => ["class_name = ?",
class_name]).each do |file_class|
p file_class.file_name + "aaa"
FileInclude.find(:all, :conditions => ["file_name = ?",
file_class.file_name]).each do |file_include|
p file_include.include_file_name + "bbb"
FileClass.find(:all, :conditions => ["file_name = ?",
file_include.file_name]).each do |file_class|
p file_class.class_name + "ccc"
next if stack.include?(file_class.class_name)
find_class(file_include.include_file_name, stack)
end
end
end
stack.pop
end
---------------------
results
---------------------
CTAgentHome
"CTAgentHome.haaa"
"\"FWCTBase.h\"bbb"
"CTAgentHomeRepccc"
"FWCTBase.h"
"CTAgentHomeccc"
"\"FWMOBase.h\"bbb"
"CTAgentHomeRepccc"
"FWMOBase.h"
"CTAgentHomeccc"
"\"MOSAgentBasicInfo.h\"bbb"
"CTAgentHomeRepccc"
"MOSAgentBasicInfo.h"
"CTAgentHomeccc"
"\"MOSAgentCriteriaInfo.h\"bbb"
"CTAgentHomeRepccc"
"MOSAgentCriteriaInfo.h"
"CTAgentHomeccc"
"\"MOSAgentInfo.h\"bbb"
"CTAgentHomeRepccc"
"MOSAgentInfo.h"
"CTAgentHomeccc"
"\"MOSAgentMessageInfo.h\"bbb"
"CTAgentHomeRepccc"
"MOSAgentMessageInfo.h"
"CTAgentHomeccc"
"CTAgentHomeRep.haaa"
"\"FWMOBase.h\"bbb"
"CTAgentHomeccc"
"CTAgentHomeRepccc"
"FWMOBase.h"
"\"MOSAgentBasicInfo.h\"bbb"
"CTAgentHomeccc"
"CTAgentHomeRepccc"
"MOSAgentBasicInfo.h"
"\"MOSAgentCriteriaInfo.h\"bbb"
"CTAgentHomeccc"
"CTAgentHomeRepccc"
"MOSAgentCriteriaInfo.h"
"\"MOSAgentInfo.h\"bbb"
"CTAgentHomeccc"
"CTAgentHomeRepccc"
"MOSAgentInfo.h"
"\"MOSAgentMessageInfo.h\"bbb"
"CTAgentHomeccc"
"CTAgentHomeRepccc"
"MOSAgentMessageInfo.h"
I made mistake somewhere but where...
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---