Add rb-grib gem to Rails application - ruby-on-rails

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'

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

Gem can be required in IRB but not by Rails

When I add
require 'soundcloud'
in Rails and start the server using
rails server
I get
...rb:9:in `require': cannot load such file -- soundcloud (LoadError)
the same yields
=> true
in IRB.
I installed Ruby, Rails, etc following http://installrails.com/.
Any ideas what could be causing this?
Why don't you use Bundler?
Add to Gemfile:
gem 'soundcloud'
then run
bundle install
in the root of your project and it all should work automatically.

Does a Rails 3.0.0.beta app only see bundled gems in the console?

I have a library that I'm trying to get working with rails 3 (specifically feedzirra) which I can require ok in irb but it breaks the console in my app with the following error:
http://pastie.org/855976
Found a bit of info on using feedzirra with rails 3. It looks like your problem might be with the Loofah library feedzira uses. It uses the deprecated config.framework.
Here's a link with some more info http://www.mythoughtpot.com/2010/02/10/feedzirra-on-rails3/
Rails3 modifies the $LOAD_PATH so it only contains gems listed in the Gemfile.
($LOAD_PATH is an array of directories where Ruby searches for libraries).
So you must add the Gem to the Gemfile and run bundle install.
You can check if the gem is in your path by typing puts $LOAD_PATH.grep(/feedzirra/) in the rails console.
For more information on using Bundler in Rails3 check out these:
http://railsdispatch.com/posts/bundler
http://railscasts.com/episodes/201-bundler

Resources