What does this mean and how do I fix it? It makes my server hang with a 500 error. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 10/2/06, bluengreen <pnovess-ee4meeAH724@public.gmane.org> wrote:> What does this mean and how do I fix it? It makes my server hang with a > 500 error.A full backtrace would be useful. Chances are, you''re trying to do something that tries to Marshal a Net::LDAP object, and that can''t be marshaled because it''s got a singleton method on it (that is, the object''s singleton class has a method, and if you don''t understand that -- I suggest you look up singleton class, metaclass, and eigenclass in the context of Ruby). Have you got your Net::LDAP operation modified and/or in a transaction? -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You are correct about all those things. That is exactly what I''m doing. I have my Net::LDAP stuff inside of my ActiveRecord model for users. It''s within a login method. Here is what I''m trying to do, def self.login(username, password) begin ldap = Net::LDAP.new ldap.host = "gonzo" ldap.port = 389 result = ldap.bind_as( :base => "dc=net", :filter => "(cn=#{username})", :password => password ) rescue => e false end result.first end And then use it like: session[:user] = AuthUser.login(params[:user]["username"], params[:user]["password"]) I''ve tried a million differnt ways. I can get it to work if all I return from the method is true or false. If I try return any attributes from the LDAP object it dumps errors on me. It errors out when I try it outside of AR as well. I just don''t know how would you go about saving the attribute values into the session? Are they always tied to the object? Is there any way to copy the values only? Thanks in advance, Phill Austin Ziegler wrote:> On 10/2/06, bluengreen <pnovess-ee4meeAH724@public.gmane.org> wrote: > > What does this mean and how do I fix it? It makes my server hang with a > > 500 error. > > A full backtrace would be useful. > > Chances are, you''re trying to do something that tries to Marshal a > Net::LDAP object, and that can''t be marshaled because it''s got a > singleton method on it (that is, the object''s singleton class has a > method, and if you don''t understand that -- I suggest you look up > singleton class, metaclass, and eigenclass in the context of Ruby). > > Have you got your Net::LDAP operation modified and/or in a transaction? > > -austin > -- > Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ > * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ > * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 10/3/06, bluengreen <pnovess-ee4meeAH724@public.gmane.org> wrote:> You are correct about all those things. That is exactly what I''m > doing. I have my Net::LDAP stuff inside of my ActiveRecord model for > users. It''s within a login method. Here is what I''m trying to do,...Unfortunately, I don''t really do much with Rails or Net::LDAP. Hopefully others can help with that, but the dump message is a pure Ruby issue related to trying to Marshal a singleton value. This means you can''t put the actual auth result in the session (I''m assuming it''s a Marshaled object); you will have to somehow get the data out of the auth result and use those in the session. You may want to try to write a little Ruby program that tries your auth without Rails and get help about that from the Net::LDAP homepage. -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:> On 10/2/06, bluengreen <pnovess-ee4meeAH724@public.gmane.org> wrote: >> What does this mean and how do I fix it? It makes my server hang with a >> 500 error. > > A full backtrace would be useful. > > Chances are, you''re trying to do something that tries to Marshal a > Net::LDAP object, and that can''t be marshaled because it''s got a > singleton method on it (that is, the object''s singleton class has a > method, and if you don''t understand that -- I suggest you look up > singleton class, metaclass, and eigenclass in the context of Ruby). > > Have you got your Net::LDAP operation modified and/or in a transaction? > > -austin > -- > Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ > * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ > * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.orgAustin, you''re right. The Net::LDAP::Entry class has some stuff that can''t be marshalled. (For one thing, there was a hash that took a closure.) However, I changed this stuff recently so there should be no problem marshalling entries. Look in entry.rb in the Net::LDAP distro for commentary. Bluengreen, if you''d be so kind as to sync to the latest Net::LDAP source code and try again, I''d appreciate it. I think your problem is fixed but it would be very helpful if you can confirm or deny. There''s enough new stuff in Net::LDAP (performance improvements, LDIF support) that it''s time for a new release anyway. -- 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 -~----------~----~----~----~------~----~------~--~---
How do I sync with the source code? I have version 0.0.4 now. Is there a svn repository? Thanks, Phill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bluengreen wrote:> How do I sync with the source code? I have version 0.0.4 now. Is there > a svn repository? > > Thanks, > PhillYes, the source is on Rubyforge. There are instructions there on how to work with SVN anonymously. If you can''t figure it out, send me a private email and I''ll send you a gem. -- 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 -~----------~----~----~----~------~----~------~--~---
Francis Thanks. I got the newest code. I got it to work. But I had to convert it to an array to get it to my session variable: result.first.to_a Other wise I still get the dump error. I dunno. Is this how it should work? Or should I just be able to pass the entry to my session? I get to the vars like this in my views and code.... session[:user][0][:dn] session[:user][0][:cn] etc..... It seems a little obtuse. But I''m still pretty green at Ruby. Thanks, Phill Francis Cianfrocca wrote:> bluengreen wrote: > > How do I sync with the source code? I have version 0.0.4 now. Is there > > a svn repository? > > > > Thanks, > > Phill > > Yes, the source is on Rubyforge. There are instructions there on how to > work with SVN anonymously. If you can''t figure it out, send me a private > email and I''ll send you a gem. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
bluengreen wrote:> Francis Thanks. I got the newest code. I got it to work. But I had to > convert it to an array to get it to my session variable: > > result.first.to_a > > Other wise I still get the dump error. > > I dunno. Is this how it should work? Or should I just be able to pass > the entry to my session? > > I get to the vars like this in my views and code.... > > session[:user][0][:dn] > session[:user][0][:cn] > > etc..... > > It seems a little obtuse. But I''m still pretty green at Ruby. > > Thanks, > PhillI have to guess at this because I can''t see your code, but I think you''re taking the return value from a call to Net::LDAP#search, which is an array of Net::LDAP::Entry objects, and trying to stuff the result into a Rails session. And of course the session barks because it can''t persist the object. If you''re sure you''ve installed the latest code and Rails is seeing the latest, then you should look at the error backtrace to see if Rails is trying to call Net::LDAP::Entry''s custom _load and _dump methods. (If you installed Net::LDAP 0.0.4 as a gem, then try uninstalling the gem, because otherwise Rails might not be loading the version of Net::LDAP you think it is.) If you really can''t get past this, then there are alternative approaches, but I really think this should work without any weird hacks. -- 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 -~----------~----~----~----~------~----~------~--~---