I'm trying to create a Ruby on Rails web app that will sync with google calendar. I tried to use omniauth but it didn't work for me.
I found a rails gem that should do the job for me: gcal4ruby
But for now it isn't working.
I use the code:
#serv = Service.new
#serv.authenticate 'account#gmail.com', 'pass'
and got an error:
uninitialized constant UsersController::Service
In my gemfile using:
gem 'gcal4ruby', '0.5.5'
Gem was installed successfully after bundle install.
By trying to use similar gems I got the same error so I suppose that issue is something else.
I tried to use require "gcal4ruby" in my code and got error:
cannot load such file -- gcal4ruby
I'm using ruby 1.9.3 and rails 4.0.2.
Thanks for help.
Try:
require 'gcal4ruby'
include GCal4Ruby
Which mixes-in the Service class.
Note, that GCal4Ruby uses version 2 of the google calendar api which is deprecated and will not work after November-17th 2014.
Here is a great tutorial on getting a rails app working using omniauth.
Related
I'm new to Rails and I got a problem.
My new project requires rb-grib gem (link to ruby gems: https://rubygems.org/gems/rb-grib/versions/0.2.2). This gem requires GRIB API library, I installed it using brew install grib-api. It works in irb and .rb scripts. I need to use it in my Rails app, but I get an error LoadError: cannot load such file -- numru/grib. What I need to do to make it work and deploy to Heroku in future?
You need to add
require 'numru/grib'
I am receiving the following error message when attempting to authenticate with Facebook in a rails app using MongoMapper:
It appears that MongoMapper is not being loaded properly, but I am not sure why. In my Gemfile I include gem 'mongo_mapper, gem 'bson_ext', and gem 'omniauth-facebook', '~> 1.4.1'. I also followed the setup instructions here: http://mongomapper.com/documentation/getting-started/rails.html to completion. I am able to run the $ mmconsole, as well as connect to the mongod using the $ mongo. Is there another configuration step that I missing to ensure that mongo_mapper can be loaded properly? Thanks in advance for any assistance, I am new to MongoDB in general.
EDIT:
Here is what my SessionsController looks like, where the LoadError originates:
I get the following error when trying to use the AudioInfo class (that comes with the ruby-audioinfo gem):
uninitialized constant PlaylistsController::AudioInfo
I have bundled the gem. Have restarted my server as well. Mp3Info seems to be working fine as I am using ruby-mp3info gem as well. Using rails 4 and latest gem version: https://github.com/moumar/ruby-audioinfo
You need to require the gem for your PlaylistsController class. Try putting this at the top of your file:
require 'audioinfo'
This hasn't got anything to do with paperclip, btw.
I've upgraded to rails 3.2 from a early version of rails 3.
I was using the AWS:S3 class to create buckets and what not.
The following code was working inside a model:
AWS::S3::Base.establish_connection!(:access_key_id => ...blah blah blah
I was also requiring the gem in the model like so:
require 'aws/s3'
However now I've upgraded and have ran all the updates on blunder, I'm getting the error:
uninitialized constant AWS::S3::Base
...when trying to establish a connection to S3.
Does anyone know what this is happening and how to fix it. Thanks.
I know you said it doesn't have to do with Paperclip but are you also using Paperclip in addition to the s3 gem in your app? I don't think newer versions of Paperclip depend on the aws-s3 gem anymore and instead depend on the aws-sdk gem.
Try replacing the aws-s3 gem with the aws-sdk gem.
I'm trying to use the validates_timeliness gem and followed the install instructions in the documentation: https://github.com/adzap/validates_timeliness
gem 'validates_timeliness', '3.0.2'
bundle install
rails generate validates_timeliness:install
I was then able to successfully add rspec tests and get them to pass using the validates_datetime feature from the gem
However, when I go to my new view in a browser, I get the error:
undefined method 'validates_datetime' for #
I also tried adding require 'validates_timeliness' at the top of the model file and then later at the top of the controller file. In those cases I get the error: 'no such file to load -- validates_timeliness
Any help would be much appreciated, have been trying to do extensive googling.
As noted in the instructions, it must be installed as both a plugin and a gem. When installed as a gem alone, seems to work fine with RSpec, but not in the browser.
How I fixed:
So anyone else that runs into this problem may also try running this code from master to install as plugin:
rails plugin install git://github.com/adzap/validates_timeliness.git
adzap/validates_timeliness#installation