Editing a gem definition on HEROKU (opentok) - ruby-on-rails-3

quick question about Heroku. My app is using a gem called opentok. To function outside of a "sandbox" mode, the app requires changing an API link in a gem file called opentok.rb. I did that locally and the app works fine. however, when I deploy to heroku, the app does not work because heroku looks at my gem file and gets the unmodified gem lib of opentok which then runs my app on the heroku server in sandbox mode.
Is there a way I can access the opentok gem file (opentok.rb) on the heroku server and edit it with gvim from a console?
Thank you!!

Unpack the gem to your vendor directory, edit it as you require, then tell Bundler where to retrieve the gem from.
Command line:
gem unpack opentok-VERSION --target vendor/gems
Bundler:
gem 'opentok', :path => "vendor/gems/opentok-VERSION"
After you've done all this, do a bundle install, add the vendored Gem to your git repository, and push to heroku.

For the opentok gem, though, the api url can be passed directly as an option:
opentok = OpenTok::OpenTokSDK.new #api_key, #api_secret, :api_url => 'https://api.opentok.com/hl'
this feature is documented in the spec/opentok_spec.rb file. Look for:
it "should be possible to set the api url as an option" do
Thanks to Stijnster, the opentok gem creator, for pointing it out to me!

Related

How to setup spree_static_content with spree 3.X and rails 5 to generate static pages

I have been trying to setup gem spree_static_content with spree 3.X and rails 5 but there are endless errors (migrations not running, gem dependencies) which are coming. Documentation is outdated and no help on any of the gems and spree commerce project. If someone has recently used these projects please share the debugging results.
When setting up spree_static_content gem with Rails 5.x and spree 3.x there are various errors you will get when you add only gem spree_static_content to your Gemfile.
Install following gems to your Gemfile and you will not get any error and will easily setup cms for static content for your application.
gem 'spree_static_content', github: 'spree-contrib/spree_static_content'
gem 'globalize', git: 'https://github.com/globalize/globalize'
gem 'activemodel-serializers-xml'
gem 'spree_i18n', github: 'spree-contrib/spree_i18n'
gem 'spree_globalize', github: 'spree-contrib/spree_globalize'
Next, run following commands
bundle install
bundle exec rails g spree_i18n:install
bundle exec rails g spree_globalize:install
bundle exec rails g spree_static_content:install
Now, simply create pages from admin but don't forget to select the store-name checkbox for route to work for spree 3.x.

Rails getting error when generating shopify app

I'm getting an error when generating shopify app using rails. Screenshot is shown below:
Can anyone tell me what is going wrong?
You have probably added the shopify gem to the gems file.
all you need to do is to run
bundle install
so the app will install and use the new gem

Spree-social and omniauth

I am new to ruby and have spree-ecommerce application on spree .70 . I am trying to add Facebook Authentication using spree-social. Install request fails , when I follow exact steps. Here is what I get:
Could not load 'omniauth'. Please ensure you have the omniauth gem >= 1.0.0 installed and listed in your Gemfile.
I see same error even after running gem install omniauth
I had the same problem but I resolved it by watching the video tutorial at this address http://railscasts.com/episodes/241-simple-omniauth. It shows an introduction to OmniAuth.

Heroku Forcing Me to Push Gemfile Each Time

I have a requirement in my Rails application (3.0.7) for the gem yajl-ruby. For some weird reason, every time I do a push, Heroku (Bamboo stack) doesn't recognize that the gem is listed in my gemfile.
So what happens is that my application crashes each time I do not push the gemfile. To fix this, I need to change something in my gemfile (like add a character to a comment or something inconsequential like that) and push the gemfile to Heroku again (even though there were no gem changes). It doesn't make sense because when I close from my Heroku git (even when the app is in a crashed state), the gemfile is fine, with yajl-ruby in there.
Has anyone else ever had a similar issue? I'm trying to figure out why this is and how it can be rectified so I don't need to keep making these small changes to my gemfile and pushing it?

rails-geocoder environmental problem in Rails 3 app

I'm working with Alex Reisner's geocoder gem on a Rails 3 app (3.0.3) because I'm concerned about GeoKit's shakey Rails 3 compatibility. Alex's gem looked perfect for my application so I started using it and had it working flawlessly last night on my Macbook. I pushed the app to Github when I got it running.
Today, I did a git clone of the app on a desktop Mac. Same version of Ruby, Rails and identical source and Gemfile. This time geocoder is throwing this exception:
NameError (uninitialized constant Geocoder::Net):
app/controllers/restaurants_controller.rb:16:in `create'
My models use after_validation :fetch_coordinates to geocode the model upon save.
Has anyone noticed any other dependencies outside the bundle that could cause this? I like the way Alex put this one together but may give geokit-rails3 a try even though it's an unfinished port.
I just released gem version 0.9.7 which should solve this problem.