[Ruby On Rails] Get the variable type in ruby on rails
is_a()
addr = Array.new
addr.is_a?Array #returns true
addr = Array.new
addr.is_a?Array #returns true
cookies[:login] = { :value => "asdf", :expires => Time.now + 600}
The above cookie will :expires in 10 min .
To Delete the Cookie in Ruby on rails:
cookies.delete :login
To Delete Cookie in Javascript:
createCookie(":login","",-1);
Time.now # Returns Fri Mar 08 13:27:24 +0530 2013
Time.now.to_i # Returns the unix timestamp value 1362729785
Syntax:
string.gsub("<search char>","<replace Char>")string.gsub(/'/,"") #replce/remove single quotes from the string