cannot load such file -- mongo_mapper/document - ruby-on-rails

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:

Related

How to use Google Calendar from Ruby On Rails

Anyone has a recent good start (or course) to access a Google Calendar from ROR and manipulate it. I managed to login via the 'omniauth-google-oauth2' gem but cannot succeed using the 'google-api-client' or is there another way? I'm new to Ruby and ROR.
didn't work with G. calendara but maybe try this gem https://github.com/northworld/google_calendar
so open Gemfile
# Gemfile
# ...
gem 'google_calendar'
# ...
then run
bundle install
that should install the gem, then just follow the instructions in Readme

Rails gcal4ruby gem uninitialized

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.

Rails and outside libraries

I am trying to use this gem in my rails application, but when I add it to my gem file and try to use it I get an error saying that it did not found the methods required (I am using it inside a controller). Also require 'bn4r' does not help as rails tells me that it cannot load such a file, which is odd. I can access the library from the development console with no problems any idea as to why this happens?
After adding the gem to the Gemfile:
gem 'bn4r'
install it:
$ bundle install
Restart the server and use it like this:
BayesNet.new

Getting 'undefined method' error or 'no such file to load error' trying to use validates_timeliness 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

Unable to generate friendly_id from gem

I'm trying to use Friendly ID to handle slugs in my Rails app. When I run "rails generate friendly_id", I get the following error:
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': no such file to load -- babosa (LoadError)
However, the babosa gem is definitely installed.
How can I even begin to solve this?
I was able to fix the problem by installing Bundler and adding the following lines to "Gemfile" in the root of my app:
gem 'babosa'
gem 'friendly_id'
I've not seen this problem myself, but have you tried the Google Group for the gem? It looks like that's the author's preferred communication method, and he looks to be fairly responsive there.
http://groups.google.com/group/friendly_id

Resources