It looks like there is a trailing comma after the last argument to the devise method.
Up vote 0 down vote favorite share g+ share fb share tw.
Im trying to set up an authentication system against an LDAP active directory using devise. (following the tutorial http://wiki.phys.ethz. Ch/readme/devise_with_ldap_for_authentication_in_rails_3 Ive followed the instruction exactly, and when I try running the app im getting the following error: undefined method `to_sym' for # Anyone know the cause of this or at least how to find the file that contains this line?
*******UPDATE******* user. Rb model: class User Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :ldap_authenticatable, :rememberable, :trackable, # Setup accessible (or protected) attributes for your model attr_accessible(:login, :password, :password_confirmation, :remember_me) end ruby-on-rails devise link|improve this question edited Aug 12 '11 at 17:59 asked Aug 12 '11 at 17:29Jonah Katz78610 92% accept rate.
To_sym is a method that will convert the value into a ruby symbol ( ---> :some-object. Without seeing code and such I don't know exactly what's going on. I've never tried to use ldap w/devise.
– jaydel Aug 12 '11 at 17:35 @jaydel Exactly. The error doesn't say where to_sym is located. Do you know of any debugging methods to get a more detailed error?
– Jonah Katz Aug 12 '11 at 17:36 I'm not entirely sure. Have you tried the ruby debugger? Also, I've encountered similar things like this in other ways...for example missing method 'gsub' or 'match' on some things and in those cases it turned out that I was defining something as a class rather than a string in an association....for example :class_name => FooObject rather than :class_name => "FooObject".
You might check out places where you're configuring "special circumstances" with these sorts of hash values... – jaydel Aug 12 '11 at 17:41 Devise injects a call to attr_accessible in your user model. This creates a whitelist of attributes which can be assigned values through the params hash (this sounds related to the error you're getting). If you posted your model, specifically the call to devise, it would probably help us debug this.
– dwhalen Aug 12 '11 at 17:56 @Danny Ok I updated my question with the user. Rb model – Jonah Katz Aug 12 '11 at 18:00.
It looks like there is a trailing comma after the last argument to the devise method: devise :ldap_authenticatable, :rememberable, :trackable, The ruby interpreter then assumes that attr_accessible is the next argument to the method. The proper argument type is a symbol, so it calls to_sym on attr_accessible, which is a method and does not have a to_sym method and raises the error. Remove the trailing comma and it should work!
Great catch! Now on to the next problem – Jonah Katz Aug 12 '11 at 18:35 Net::LDAP::LdapError (no connection to server): – Jonah Katz Aug 12 '11 at 18:38 Yep, you need to start an ldap server. I have no experience with this, but I saw it done in this video: random-rails.blogspot.com/2010/07/… – dwhalen Aug 12 '11 at 18:47 I already have one I just gotta configure it properly (i use active directory).. – Jonah Katz Aug 12 '11 at 18:48.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.