so I just want to extract the longitude/latitude coordinates from a regular address(string). I went to geokit gem documentation and did precisely what was documented, yet I keep getting this error: "NameError: uninitialized constant Geokit::Geocoders::OpenSSL"
I added "geokit" to the gemfile and this:
require 'rubygems'
require 'geokit'
def get_coordinates
#a = Geokit::Geocoders::GoogleGeocoder.geocode '140 Market St, San Francisco, CA'
#a.ll
end
I've also tried adding this before, but to no avail.
Geokit::Geocoders::GoogleGeocoder.api_key = api_key
I just want coordinates, if this isn't a viable solution, can someone recommend another geocoder. I tried the railscasts but couldn't get that to work either. Any help would be greatly appreciated thanks!
Add
require 'openssl'
before
require 'geokit'.
Geokit does not automatically include the required OpenSSL gem.
I had the same problem with an old Rails app running on an old Ubuntu Lucid. I installed an old version of the geokit gem (1.5.0) and it worked.
Related
I have been struggling with rerunning my apps from MAC OS to my windows OS. I have never liked databases. Anyway, the thing is that I cannot even load up my seeds. It looks like it cannot run the pg gem methods. Here's my error
:in `ensure in run': undefined method `close' for nil:NilClass (NoMethodError)
here's the code the method gets stuck on
require_relative('../models/collection')
require_relative('../models/product')
require('pry')
Product.delete_all()
Collection.delete_all()
fw2015 = Collection.new({
'name' => 'Fall Winter 2015/2016'
})
fw2015.add()
I am pretty sure that it's something with postgres. Thank you for your help
This is a gem issue, not a PostgreSQL issue. It is probably relating to the fact that there are binary portions of the gem and they may not be building right. So you need to make sure that you have the PostgreSQL client libraries and header files installed, and that you have all necessary compilers.
Try uninstalling and re-installing the gem and see what errors and warnings show up.
I am using the latest version of paper_trail gem (2.7.1) After the gem installed and table created I have added "has_paper_trail" in my model and end up with getting "undefined local variable or method has_paper_trail". I tried even with lower versions but still getting the same error.
This is a silly mistake as we need to restart the server after gem installation.
Newbies like me often makes such mistakes. Full credit to Thomas for the kind information.
I am trying to use the gem gchartrb to create some graphs/charts in my RoR application.
I have looked into several tutorial and all say the same thing, that I have to add
require 'google_chart'
But I am getting the message:
no such file to load -- google_chart
I have the require inside my controller, I have confirmed that the gem is installed.
I am using Rails 3.
Also, I have tried adding config.gem 'gchartrb', :lib => 'google_chart' in my environment.rb as suggested here but nothing changed
Thanks for your help
EDIT:
I have also tried with the gem googlecharts, what I have in my Gemfile is:
gem "googlecharts", :require => "gchart"
but I get no such file to load -- gchart when I try to load the view.
I am not sure, it is required now or not. But it worked for me in Rails 3 as well. I am using Rails 3.0.10. I added below 2 lines and it worked for me.
1) gem 'gchartrb' in Gemfile
2) require 'google_chart' in config/boot.rb
Hope it helps!
config.gem is for rails 2.3.X.
For rails 3, you will need to add the gem to your Gemfile and run gem bundle
You may also need to check that the google_charts gem actually supports Rails 3...
Given that the latest code update seems to have been in 2008 - that might not actually be likely. :(
You can try it anyway and see...
Hi
I know this question have been asked before but the answers there isn't working for me.
I still get the, when redirecting back to my site.
/auth/failure?message=invalid_response
I have ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] installed, using rails 3.0.7 and the required gems installed. I read on another thread that you should have pure_json added to the gemfile to make it work. But that didn't help me either.
I'm clueless... Thanks in advance
authenticationscontroller
def index
#authentications = current_user.authentications if current_user
end
def create
#render :text => request.env["omniauth.auth"].to_yaml
auth = request.env["omniauth.auth"]
current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid'])
flash[:notice] = "Authentication successful."
redirect_to authentications_url
end
I was able to get this to work by specifying the following in my Gemfile
gem 'omniauth', '0.2.0'
Version 0.2.6 wouldn't work for me. I also updated by .rvmrc to rvm use 1.9.2#rails3. Oh, also make sure you're logged in - do note that in your code above you are assuming that current_user exists. See Ryan's Railscast part two for allowing user creation via Omniauth.
I've got a demo working here, but do note I'm doing authentication from scratch rather than using Devise.
I use rails 3.
In development mode I installed some gems for Testing (diff-lcs, nokogiri, rspec, webrat).
Since I did that, if I try to cap-deploy to the production server, it complains:
"Could not find diff-lcs in any of the sources (Bundler::GemNotFound)"
I don't want to install them on the server, because I don't need the testing purpose gems on the production server.
Can I put something in the Gemfile to maybe exclude them for production mode?
Or else how can I handle this?
Thank you very much for answering this questiion by a struggling beginner...
You can put those gems in their own group like this:
group :development, :test do
gem 'diff-lcs'
end
This page explains groups in more details: http://gembundler.com/groups.html