Skip to main content

Kola Gem In rails Getting facebook User Details

graph_api = Koala::Facebook::API.new("xxxxxxxx")
 user_details = graph_api.get_object("me")
 facebook_id = user_detail["id"]
 facebook_email  =  user_detail["email"]
 first_name = user_detail["first_name"]
 last_name = user_detail["last_name"]
 full_name = user_detail["name"]
 gender = user_details["gender"]
location = user_details["location"]["name"]


=========================================================================
=========================================================
===================================================


The O/p of the above data will be like these


"id"=>"10000216852162", "education"=>[{"school"=>{"id"=>"269058053195606", "name"=>"CBHS"},

"type"=>"High School", "year"=>{"id"=>"113125125403208", "name"=>"2004"}}, {"concentration"=>[{"id"=>"201737456532931", "name"=>"B.Tech."}], "school"=>{"id"=>"120019364709619", "name"=>"Swami Ramananda Thirtha Institute of Science and Technology"}, "type"=>"College"}, {"concentration"=>[{"id"=>"104076956295773", "name"=>"Computer Science"}], "school"=>{"id"=>"122704701106493", "name"=>"SRTIST Engineering College"}, "type"=>"College", "year"=>{"id"=>"201638419856163", "name"=>"2011"}}], "email"=>"xxxx@gmail.com", "favorite_athletes"=>[{"id"=>"1456831277908639", "name"=>"P T Usha"}, {"id"=>"293457884154813", "name"=>"MAXII"},
{"id"=>"467329063346953", "name"=>"World's no 1 finisher : Dhoni"}, {"id"=>"344128252278047", "name"=>"Sachin Tendulkar"}, {"id"=>"1411315035751559", "name"=>"MSD - Best Finisher"}, {"id"=>"218797101647631", "name"=>"Awesome Catches & Updates Of Cricket"}], "favorite_teams"=>[{"id"=>"149756715038769", "name"=>"Kings XI Punjab"}, {"id"=>"67496419489", "name"=>"Kolkata Knight Riders"}, {"id"=>"107844962567241", "name"=>"Chennai Super Kings"}, {"id"=>"153516655618", "name"=>"Royal Challengers Bangalore"}, {"id"=>"198358615428", "name"=>"Mumbai Indians"}, {"id"=>"403725913031209",
"name"=>"SunRisers Hyderabad"},
{"id"=>"98027790139", "name"=>"Deccan Chargers"}, {"id"=>"82021195079", "name"=>"Rajasthan Royals"}, {"id"=>"429969540378338", "name"=>"Indian Cricket Team | World Champions |"}], "first_name"=>"raghu", "gender"=>"male", "hometown"=>{"id"=>"122424091133500", "name"=>"Bangalore, India"}, "languages"=>[{"id"=>"111935758826010", "name"=>"Telugu"}, {"id"=>"106059522759137", "name"=>"English"}], "last_name"=>"Reddy", "link"=>"https://www.facebook.com/raghu.reddy", "location"=>{"id"=>"106377336067638", "name"=>"Bangalore, India"}, "locale"=>"en_US", "middle_name"=>"", "name"=> "raghu reddy", "timezone"=>5.5, "updated_time"=>"2014-12-19T10:22:29+0000", "username"=>"raghu.reddy", "verified"=>true, "work"=>[{"employer"=>{"id"=>"191128660967436", "name"=>"Infosys"}, "location"=>{"id"=>"106377336067638", "name"=>"Bangalore, India"}, "position"=>{"id"=>"109542932398298", "name"=>"Software Engineer"}, "start_date"=>"2012-01-17"}, {"end_date"=>"2011-12-31", "employer"=>{"id"=>"104563232948592", "name"=>"Wipro"}, "location"=>{"id"=>"106377336067638", "name"=>"Bangalore, India"}, "position"=>{"id"=>"188467934532589", "name"=>"SOFTWARE ENGINEER TRAINEE"}, "start_date"=>"0000-00"}

Comments

Popular posts from this blog

Get the Current url in ruby on rails

request.refererrequest.fullpathrequest.fullpath.split("?")[0]request.referer or request.env['HTTP_REFERER'] your controller to get the referer url. 

--------------------
request.original_url
request.url
request.host_with_port
<link rel="canonical" href="<%= request.url %>" />
<%=request.path%>
How can I get the current absolute URL in my Ruby on Rails view?
The request.request_uri only returns the relative URL.
request.env['REQUEST_URI']

 For Rails 3.2 or Rails 4 you should use request.original_url to get the current URL. More detail.

For Rails 3: You want "#{request.protocol}#{request.host_with_port}#{request.fullpath}", since request.url is now deprecated.

For Rails 2: You want request.url instead of request.request_uri. This combines the protocol (usually http://) with the host, and request_uri to give you the full address

Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).?

Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).) In rails?


1)change the gemfile in mysql version
 gem 'mysql2'

2)Change to mysql2 version
 gem 'mysql2','0.3.20'

Active Scaffold : Add radio buttons to your form ruby on rails ?

Active Scaffold : Add radio buttons to your form ruby on rails ?

The way to add radio buttons to your active scaffold create/update from is as shown below

#Controller

class UsersController < ApplicationController
active_scaffold :user do |config|
config.label = “Users”
config.columns = [:name, :gender]
config.columns[:gender].form_ui = :radio
config.columns[:gender].options[:options] = [['Male', '1'], ['Female','2']]
end
end