last day (15 days later) » 

2:12 PM
1
A: undefined local variable or method `signin' for #<Class:0x31fa7f0>

Monk_CodeThis method from Devise, for auth by pair username and email or something else. You problem in signin variable i use login instead look my code: def self.find_first_by_auth_conditions(warden_conditions) conditions = warden_conditions.dup if login = conditions.delete(:login) if logi...

 
Should variable name be a problem and also when you put puts warden_conditions where does it print?
 
i want look inside warden_conditions, this is hash with option for login. i wanna see console output from rails server. if you puts warden_conditions and run this method, you have see this in console.
 
can u tell me where to look for it. i mean if i put puts warden_conditions where does it print
 
in rails server output if it run.
 
Here is what it printed in rails server pastie.org/private/7g1n6tu31zevisohurqw
 
2:12 PM
this is warden_conditions output {"email"=>"some@gmail.com"} line 8 in you paste
 
How do you say so? I mean i getting confused on printing the values to console.
can i print something like puts "Hello" + wardencondition
 
this is just for debbug your method, i use this always beyond pry.
no you cant this raise errors because "Hello" is a string warden_conditions is a hash.
 
How do i combine both. I mean in other languages you can append a string so that you can know its printing your line correctly.
 
in ruby you can use warden_conditions.inspect or warden_conditions.to_s methods for conversion any object to string, and after use puts("Hello" + warden_conditions.to_s)
 
Great from yesterday i was struggling on this. either way... did u get any idea on where the issue
I looked into your code
Can you explain me whats happening in this code
def self.find_first_by_auth_conditions(warden_conditions)
conditions = warden_conditions.dup
if login = conditions.delete(:login)
where(conditions).where(["lower(username) = :value OR lower(email) = :value", { :value => login.downcase }]).first
else
where(conditions).first
end
end
 
2:16 PM
devise use this method (find_first_by_auth_conditions) in your model for find in db record for authentication.
conditions = warden_conditions.dup this just duplicate params hash
and after you have simple conditional
login = conditions.delete(:login) this code return true if :login key deletes from conditions hash
 
In my case
puts conditions.to_s returned
{"email"=>"some@gmail.com"}
this hash
so if login = conditions.delete(:login)
why do we do this
 
puts conditions.to_s this return string not hash
 
yes
conditions.delete(:login) returned me empty string
I am sorry, if i am troubling u
 
yes
 
I am kinda not understanding
 
2:24 PM
look some example
 
one final question
if login = conditions.delete(:login)
what does the login variable hold
 
=> warden_conditions
=> {:login=>"+79818327398"}
 
to make it return true
 
=> warden_conditions.delete(:login)
=> "+79818327398"
and you case
=> {"email"=>"some@gmail.com"}.delete(:login)
=> nil
any operations in ruby return value
 
this is wrong
{"email"=>"some@gmail.com"}.delete(:login)
it should be
{"login"=>"some@gmail.com"}.delete(:login)
Am i right?
 
2:27 PM
=> {"login"=>"some@gmail.com"}.delete(:login)
=> nil
=>{:login=>"some@gmail.com"}.delete(:login)
=> "some@gmail.com"
have difference between "login" and :login
 
ah ah...
from where is this method being called
find_first_by_auth_conditions
 
inside devise controller
 
in my case i am passing the wrong thing to the method
{"email"=>"some@gmail.com"}
 
yeah
 
any guess on which file i need to look
 
Thanks for your time, from here i will debug more to learn
kinda atleast got an idea on what is the issue
 
sorry but my english is very terrible and i can undestand some phrase
((
 
Thats fine my friend, u r help was valuable
and u r time too
 
happy coding and welcome
 
thanks... take care
 
2:48 PM
If possible, can u answer this question
0
Q: Can anyone break down the code into a simpler form?

theJavaI am having some tough time to get this code into my head, though explanations were given. def self.find_first_by_auth_conditions(warden_conditions) conditions = warden_conditions.dup signin = conditions.delete(:signin) where(conditions).where(["lower(username) = :value OR lower(...

 

last day (15 days later) »