Monday, December 27, 2010

[Sinatra] `union': can't convert Array into String (TypeError) [Resolved]

For The Issue Please Do Following Stapes.

First uninstall gem Rack with all version.

# gem uninstall rack
Select gem to uninstall:
 1. rack-1.0.0
 2. rack-1.0.1
 3. rack-1.2.1
 4. All versions
> 4
Successfully uninstalled rack-1.0.0
Successfully uninstalled rack-1.0.1

You have requested to uninstall the gem:
        rack-1.2.1
thin-1.2.7 depends on [rack (>= 1.0.0)]
sinatra-1.1.2 depends on [rack (~> 1.1)]
oauth-0.3.5 depends on [rack (>= 0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled rack-1.2.1

root@li107-124:/mnt/ntracker/ntrack# gem list rack
*** LOCAL GEMS ***

# gem install rack --version '1.2.0'
Successfully installed rack-1.2.0
1 gem installed
Installing ri documentation for rack-1.2.0...
Building YARD (yri) index for rack-1.2.0...
Installing RDoc documentation for rack-1.2.0...

Now check your application and config.ru with following content.
--------------------------
require 'sinatra'

Sinatra::Application.default_options.merge!(
  :run => false,
  :env => :production
)

require 'App'
run Sinatra.application
----------------------------

Then Start Application with web proxy thin or anything else.
(development environment)
# thin start -p 4500
>> Using rack adapter
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4500, CTRL+C to stop
>> Stopping ...

#Use -e for Env. Like this:

# thin start -p 4500 -e staging
or

To start:
# thin -C config/config.yml -R config.ru -e staging start
to stop:
# thin -C config/config.yml -R config.ru -e staging stop

As well as for production.

Thanks-