Possible duplicate of Ruby on Rails integration with Quickbooks not working
I realize that this is a purely coding related error. I am unable to get my rails app to connect to Quickbooks due to my limited understanding of rails framework right now. Using this gem https://github.com/minimul/qbo_api, I got the button on my web app. However I still get a Routing error with my granturl section of code.
the command ruby App.rb from my console works very well. But integrating the Sinatra code in my rails app leads to this error.
This is my HomeApp.rb in config/initializers
class HomeApp < Sinatra::Base
PORT = 3000
CONSUMER_KEY = 'blah blah'
CONSUMER_SECRET = 'blah blah'
set :port, PORT
use Rack::Session::Cookie, secret: '34233adasf'
use OmniAuth::Builder do
require ::File.expand_path('../config/environment', __FILE__)
Dynopoker.configure do |config|
config.address = 'http://wakemydyno.com'
grantUrl: "http://localhost:<%= @port %>/auth/quickbooks",
No route matches [GET] "/auth/quickbooks"
Good thing, I was allowed to stew in my own stupidity while realizing the answer to this solution.
So I changed my routes.rb as follows:
Rails.application.routes.draw do get "/" => HomeApp, :anchor =>false match '/auth/:provider/callback' => 'quickbooks#callback', via: [:get,:post]
Also I removed the
line from my config.rufile.
Basically I created a quickbooks controller and added the callback.html.erb file for a callback action inside the controller. instead of using the Sinatra app for the callback, my code uses this quickbooks route just for the callback. The rest of the code flows solely from the Sinatra code.
No clue if this is the right approach to using the gem. But since it works, I am sticking with it for now.