You have not mentioned how should recursion stop properly. Anyway, code also
doesnt look very clean and I think not very efficient too. My suggestion is
first fetch all FileClass using conditions in an array, include all the
FileInclude as well (using :include) Then select, reject the record you want
to.

Sorry, if I haven't understood your problem correctly.

--
Thanks,
Abhinav
http://twitter.com/abhinav



On Thu, Sep 3, 2009 at 2:45 PM, Ahmet Kilic <
[email protected]> wrote:

>
>
> my code is ;
>
> $ssf
> def find_class(class_name, stack = [])
>  FileClass.find(:all, :conditions => ["class_name = ?",
> class_name]).each do |file_class|
>      FileInclude.find(:all, :conditions => ["file_name = ?",
> file_class.file_name]).each do |file_include|
>        FileClass.find(:all, :conditions => ["file_name = ?",
> file_include.file_name]).each do |xxxx|
>          next if stack.include?(xxxx.class_name)
>            begin
>           find_class(file_class.class_name, stack)
>
>              p  file_class
>              p "============================"
>              p file_include
>              p "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------"
>              p xxxx
>            rescue SystemStackError => ssf
>              p $ssf = ssf
>            end
>
>        end
>      end
>    end
>  end
>
>
> rake aborted!
> SystemStackError: stack level too deep: SELECT * FROM `file_includes`
> WHERE (file_name = 'IMAgentHome')
>
>
> C:/Base/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:212:in
> `log'
>
> C:/Base/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:320:in
> `execute'
>
> C:/Base/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:595:in
> `select'
> .....
>
>
> help me please!
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to