i'm trying out the OSS catarse and it works fine on my machine after following the tutorial(see the link).
Then i push it to heroku using
git push heroku master
And it works fine, the problem is when i try to migrate the db using
heroku rake db:migrate
I get
(in /app)
rake aborted!
no such file to load -- capybara/rails
And i'm not sure what should i do, i saw a couple of solutions online, but the people that had this same problem never got an answer on the forums they post.
One of the answers was:
I've moved capybara outside the groups and now rake db:migrate works
just fine, tks!!
I must say this person had a terrible english, i'm not sure what he did, buts thats pretty much all he says.
I thought he meant the Gemfile line
group :test, :development do
Found on the original file, i removed it and the problem remains.
Any other ideas? any help would be appreciated, i'm just starting to learn rails and i'm much willing to learn anything i need to solve this issue so feel free to send me rtfm just tell me which :P
I found that what he meant was moving the line above
group :test, :development do
Just for clarification this is how it looked before
33 group :test, :development do
34 gem 'capybara', ">= 0.4.0"
Those are the line numbers btw and this is after
33 gem 'capybara', ">= 0.4.0"
34 group :test, :development do
Now heroku rake db:migrate works as expected, the app still doesnt work but thats for another question maybe.
If anyone care to explain that would be much appreciated.
Related
On localhost my app works well even when I run it in production:
rails s -e production
However on heroku it crashes. Previously it worked. I can't find the reason because "heroku logs" doesn't show much it info, it basically says "error". What kind of error? Where exactly?
Here's my gemfile:
ruby '2.2.1'
gem 'rails', '4.2.4'
group :assets do
gem 'sass-rails'
gem 'uglifier'
end
We use LogEntries in Heroku.
They have a really good feature called "Live Tail" - allowing you to see how the server runs in real time. This gives you verbose access to all the errors etc (much better than Heroku logs):
It's totally free and allows you to monitor your dyno in "real time"; it shows the actual Rails errors too.
I am working with Rails 4 and I am using this library for my pagination, but I have a problem when I deploy to production, I see this error:
/home/deployer/apps/app/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/dependencies.rb:228:in
require'/home/deployer/apps/app/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/dependencies.rb:228:inrequire':
No such file to load -- will_paginate/array (LoadError)
In development this library is working but in production I have this error, I was searching for this error on Google but I can't find a solution.
Do you have any idea what may be wrong? Let me know when you find out please.
Thanks for you help.
First things first, check that the will_paginate gem is enabled for production in your Gemfile. It may be under the :development group only.
I will try my best to explain my issue.
I have a SQLite3 database file of about 50,000 records that I compiled and use in my app. This database is read only and is only used to query and pull data from. I created a model for it in rails and it looks like this.
class Locations < ActiveRecord::Base
establish_connection(
:adapter => 'sqlite3',
:database => 'db/locs.sqlite3'
)
set_table_name "Locations"
end
Everything works great on the development end, but fails when I deploy to Heroku. I'm assuming the issue is that Heroku runs on Postrgres but I need this database to be separate from the main production database and I don't need something fancy. All I need is for the app to query some records from this file.
Is there a solution out there? Thanks
Allowing SQLite3 read only can be enabled by following the steps from this git repo.
https://github.com/yotsumoto/heroku-buildpack-ruby-with-sqlite3
After running:
$ heroku config:set BUILDPACK_URL=https://github.com/yotsumoto/heroku-buildpack-ruby-with-sqlite3
I was able to git push heroku master with gem 'sqlite3' still in the Gemfile.
I'm really not understanding your question but I'm assuming you want to use sq in dev & testing but want to use postrgres in product, correct? If so, the code below should help. Switching from sqlite to pg is rather seamless so you shouldn't have a problem doing so.
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg', '0.12.2'
end
The simple answer to your question is it's not possible to do what you're trying to do. Heroku don't have necessary prerequisites installed to even let you install the sqlite gem.
I am trying to user RSpec and failing to configure MiniTest/Spork/Capybara/Guard. My Gemfile is all set and I ran the command to install RSpec.
Unfortunately, the application continues to "think" my tests are in the test directory. Sorry, they're not. They're in specs, and the framework should really know that.
Maybe it's some sort of configuration issue from trying to get the impossible stack above to work that I still have in place. Where does Rails "decide" in which directory to look for tests? RSpec itself is the one that created the spec directory.
This is how rspec-rails should be included in your Gemfile.
group :development, :test do
gem 'rspec-rails', '2.11.0'
end
Make sure it is added in both :development and :test group.
I'm new to Heroku. I tried pushing a simple test Rails 3.1.1 app to Heroku. The only changes that I made to it from the "new" Rails app template was to create a Home controller and point the root to home#index. I also ran
rails g scaffold Mark type:string start_time:datetime end_time:datetime subject:string measure:float special_event:boolean flag:boolean in_progress:boolean
so that I could run a database migration and test to make sure all showed up properly. The final change that I made was to the Gemfile, which now looks like this:
source 'http://rubygems.org'
gem 'rails', '3.1.1'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I followed the Heroku tutorial for this. The push worked, there were no errors reported. I ran heroku rake db:migrate heroku addons:add logging. I also deleted public/index.html from the app. When I run the app locally with rails server, it works fine. I also can manually navigate to the "marks" index, per the scaffold.
When I run heroku open, all I get is the standard We're sorry, but something went wrong. Rails page. heroku logs shows me nothing at all.
What am I doing wrong here? This is about as simple as test cases get, yet I can't get it to work after fiddling with it for hours, creating new apps, deleting this app and trying again, trying to deploy another app, etc.
The problem here is that Rails 3.1 asset pipeline doesn't work 'out of the box' on Bamboo-mri-1.9.2 which is the default when you do heroku create.
The solution is to do heroku create --stack cedar and then push - all will be fine then :)
Try doing this just to see if this works:
rails new stackoverflow
cd stackoverflow/
git init
git add .
git commit -m 'all'
git remote add origin git#github.com:noahc/stackoverflow.git #you'll need to change this
git push origin master
heroku create
git push heroku master
heroku open
If that doesn't work, then it is something to do with your local machine. I just ran through this and it works on my end. See: http://gentle-dawn-1050.heroku.com. If this doesn't fail, I'd try making the changes to the GemFile and see if you can get it to fail that way.
I had the same problem. Looks like you got to the bottom of your issue, but for future problem-havers I want to point out that it could be a discrepancy between the database you use for your local app and the one behind the live app. In my case, my local database was populated, and my Heroku site was empty, since l I didn't properly migrate.
This problem only became apparent when I ran "rake db:reset" in the terminal, (to clear all the data in my local app's database), after which I was able to easily find the bugs in my code.
Conclusion: if the information in your database is negligible, I would suggest clearing it and troubleshooting from there, because it could be that the site you've deployed just doesn't have data yet, and maybe your code doesn't properly handle that kind of exception.......