The backtrace when you don't set the connection at all:
NoMethodError (undefined method `[]' for nil:NilClass):
mondrian-olap (0.8.0) lib/mondrian/olap/connection.rb:15:in `initialize'
mondrian-rest-0.7.0 (java) lib/mondrian_rest/api_helpers.rb:13:in `olap'
mondrian-rest-0.7.0 (java) lib/mondrian_rest/api.rb:70:in `block in GET cubes /'
Setting the olap connection in the env is possible, but kind of a hack. It would be exceptionally nice if there were some class or something where you could set the connection "globally" so that the library could grab ahold of it.
# If you want to set the connection, just call ConnectionClass.connection = my_connection
# Otherwise it will read env['mondrian-olap.params']
class ConnectionClass
@@connection = nil
def self.connection=(connection); @@connection = connection; end
def self.connection
return @@connection ||= Mondrian::OLAP::Connection.new(env['mondrian-olap.params'])
end
end
The backtrace when you don't set the connection at all:
Setting the olap connection in the env is possible, but kind of a hack. It would be exceptionally nice if there were some class or something where you could set the connection "globally" so that the library could grab ahold of it.