PG::DupliacatePstatement: Error: prepared statement already exists

I am getting the following error in production environment

"PG::DupliacatePstatement: Error: prepared statement already exists"

Ruby version is 2.2.4 and Rails version is 4.1.3

I have the following code in my unicorn.rb file:

    before_fork do |server, worker|     Signal.trap 'TERM' do       puts 'Unicorn master intercepting TERM and sending myself QUIT instead'       Process.kill 'QUIT', Process.pid     end

    defined?(ActiveRecord::Base) and       ActiveRecord::Base.connection.disconnect!     end

    after_fork do |server, worker|       Signal.trap 'TERM' do         puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'     end

    defined?(ActiveRecord::Base) and       ActiveRecord::Base.establish_connection     end

I have added

    prepared_statement: false

in database.yml file. In environments/production.rb file, I have

    config.cache_classes = false     config.action_controller.perform_caching = false

Can anyone please suggest a solution for this error?

  [1]: http://i.stack.imgur.com/Qzm7Z.jpg

Attachments: http://www.ruby-forum.com/attachment/11326/fd35c989-0aca-488b-b57d-82ec642ae206.jpg

Show us the lines of code that cause the problem.

Colin