Reputation: 1268
I have a sinatra ruby app in heroku. I am trying to access the database via the console.When I run the heroku run console
, I am getting the following error.
Running console attached to terminal... up, run.10
/app/vendor/ruby-1.9.2/lib/ruby/1.9.1/irb/init.rb:281:in `require':LoadError: no such file to load -- ./console.
When I try to access the record using the following command, I am getting the following error :
irb(main):001:0> Setting.first
NameError: uninitialized constant Object::Setting
from (irb):1
from bin/irb:12:in `<main>'
Can anyone help me in what needs to be done. Am I missing some file or Is there a different way to access the tables in heroku?
Upvotes: 1
Views: 538
Reputation: 13306
The heroku console
thing is an old hack for rails apps, but it won't work elsewhere. As you can see from the output, it's trying to load a file called ./console
. So, create a console
file on your project root, and invoke IRB from it after having connected to your database. For example:
#!/usr/bin/env ruby
require 'irb'
require 'irb/completion'
require 'rubygems'
require 'bundler/setup'
# require something that connects to your database
# or just connect here using ENV['DATABASE_URL']
require 'your_project_setup'
IRB.start
Upvotes: 3