Hi, I''m trying to pull info from my company''s ldap server. I can''t use ActiveLDAP because our servers don''t support schema queries. I''ve created the model and the controller can pull the information (I''ve verified this from the log). However, when it comes time for the view to query the LDAP::Entry object, I keep getting ''stack level too deep''. I''ve tried searching on-line (thou shalt query google before asking stupid questions!) and have not found anything. Any ideas what''s going on? Thanks, Dave -- Posted via http://www.ruby-forum.com/.
Usually means your stack in a stupid loop somewhere. Inifinite recursion at its best. :) Hopefully its in your code where you can easily track down the problem. On 1/11/06, Dave <davefox@csd.net> wrote:> Hi, > > I''m trying to pull info from my company''s ldap server. I can''t use > ActiveLDAP because our servers don''t support schema queries. > > I''ve created the model and the controller can pull the information (I''ve > verified this from the log). However, when it comes time for the view to > query the LDAP::Entry object, I keep getting ''stack level too deep''. > > I''ve tried searching on-line (thou shalt query google before asking > stupid questions!) and have not found anything. > > Any ideas what''s going on? > > Thanks, > Dave > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Nick Stuart wrote:> Usually means your stack in a stupid loop somewhere. Inifinite > recursion at its best. :) > Hopefully its in your code where you can easily track down the problem.Nope. My code''s dirt simple at this point. Fetch my ldap entry from the server and display. I have some logging statements in my controller. The ldap entry object has data in it that I can pull out. It''s when I get to the form that I get these wonderful errors. -- Posted via http://www.ruby-forum.com/.
could you post some code of whats going on around this point? helps to digest and see whats going on. Also, would be handy to point out exactly where the code stops working and gets stuck. Never used the LDAP package before, so no idea if it could be that or not. On 1/11/06, Dave <davefox@csd.net> wrote:> Nick Stuart wrote: > > Usually means your stack in a stupid loop somewhere. Inifinite > > recursion at its best. :) > > Hopefully its in your code where you can easily track down the problem. > > Nope. My code''s dirt simple at this point. Fetch my ldap entry from the > server and display. > > I have some logging statements in my controller. The ldap entry object > has data in it that I can pull out. It''s when I get to the form that I > get these wonderful errors. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Nick Stuart wrote:> could you post some code of whats going on around this point? helps to > digest and see whats going on.Here''s the Model: class User def search(filter) LDAP::Conn.new(''ldap.server'',389) { |conn| conn.search('''',LDAP::LDAP_SCOPE_SUBTREE,"(&(#{filter}))") { |e| arr << e } return arr # yeah, I know the return is redundant. It makes me feel better! end end The controller: class UserController < ApplicationController def index user = User.new @array = user.search(''emailaddress=user@zzz.com'') end end And the view, index.rhtml <h1>User</h1> Class: <%= @array.class %><br> cn: <%= @array.get_values(''cn'') %><br> Ok. Here''s what''s going on. The code that went into the model works in a stand alone script. It fetches the data from the ldap server and will print any of the attributes from the ldap server. When I try to put the code into rails, I can verify that the model gets the data (by using puts statements in the model or controller. The info prints out in the shell running scripts/server!) and so can the controller. The problems start when I try to use the @array. If I just print out the class, I get LDAP::Entry object that I expect. When I try anything else, like the get_values method (which works from the stand alone code AND from the model/controller debugging statements!) I get the ''stack level too deep'' message. Drives me nuts! And if I''m going to move any of my projects from perl to rails, I need to pull data from the ldap server! Dave -- Posted via http://www.ruby-forum.com/.
Didier Prophete
2006-Jan-14 06:54 UTC
[Rails] Re: Re: ''stack level too deep'' error message
Dave, Take a look at my post ''rails bug ? metadata lost between page invocation ?'' http://www.ruby-forum.com/topic/51651#new I ended with a weird ''stack too deep'' weird issue as, with objects mysteriously ''loosing'' their methods... I don''t know... maybe it has nothing to do, but it does sounds strangely similar. Try this and let me know if this works: set ''config.cache_classes = true'' in your config/environments/development.rb. Again, maybe it is completely unrelated, but who knows... -Didier -- Posted via http://www.ruby-forum.com/.
> Try this and let me know if this works: set ''config.cache_classes = > true'' in your config/environments/development.rb.No luck. I still get the ''stack level too deep'' error messge. -- Posted via http://www.ruby-forum.com/.
Douglas Livingstone
2006-Jan-15 16:46 UTC
[Rails] Re: Re: ''stack level too deep'' error message
2006/1/14, Dave <davefox@csd.net>:> Nick Stuart wrote: > > could you post some code of whats going on around this point? helps to > > digest and see whats going on. > > Here''s the Model: > > class User > def search(filter) > LDAP::Conn.new(''ldap.server'',389) { |conn| > conn.search('''',LDAP::LDAP_SCOPE_SUBTREE,"(&(#{filter}))") { |e| > arr << e > } > return arr > end > end >What else is there in your User class? The above code doen''t look like it''s valid, the Conn.new block opens with { and clses with end. There aren''t any alias calls in your model are there? Douglas
>>Here''s the Model: >> >>class User >> def search(filter) >> LDAP::Conn.new(''ldap.server'',389) { |conn| >> conn.search('''',LDAP::LDAP_SCOPE_SUBTREE,"(&(#{filter}))") { |e| >> arr << e >> } >> return arr >> end >>end >> >> >> > >What else is there in your User class? The above code doen''t look like >it''s valid, the Conn.new block opens with { and clses with end. There >aren''t any alias calls in your model are there? > >Douglas > >Opps, there should be another } after the ''return arr'' statement. Other than that typo in my posting, that''s it. Dave