So this is what I get from looking at my production.logs from heroku:
Completed 200 OK in 63ms (Views: 6.0ms | ActiveRecord: 50.3ms)
Processing by EventsController#show as HTML
Parameters: {"id"=>"2"}
Rendered events/show.html.erb within layouts/application (3.7ms)
Completed 500 Internal Server Error in 15ms
Everything works locally and I have even pushed the database to heroku using db:push. Is there any more robust logging for heroku than the lines above that aren't helpful?
I'm sure its because you haven't ran rake db:migrate
If that does not work make sure that all the gems you need are in your Gem file, i.e. you are not making any local require statements to gems not in the Gemfile.
What I have found helpful is tailing the log.
And then you need to run this in console:
heroku logs --tail
Now click on the same page you were getting problems at before and check out the logs.
EDIT: on rails 4 you'll need to add the rails_12factor gem to get the detailed logs.
This isn't related to ruby but it might be good information for other googlers.
My issue not being able to see the actual error was that I was using a third party PHP tool that did this: # mysql_connect( ... ) which simply hides the error that that function didn't exist .. really evil code
Related
I'm working on a RoR app with Devise. When I came in to work today and tried to start up my local dev environment, RoR failed when I tried to go to the sign in page:
NameError at /users/sign_in
undefined local variable or method `require_no_authentication' for #<SessionsController:0x########>
It looks like the error is not being raised within the code we wrote, but instead from deep within the Devise gem. I'm guessing that somehow, my dev machine isn't configured right.
Here are some things I've tried to fix the bug:
I ran rake db:migrate and rake db:terraform.
I ran bundle install.
I ran rvm gemset empty and bundle install to reinstall all of my gems.
None of these worked.
In addition, here are a couple more strange things about this error:
None of the other devs at my workplace are having the same error, even though they're on the same codebase.
After trying to figure out the error for a while, I switched to a branch that I haven't updated since before I started getting this bug. Even though it was working before the weekend, that branch now fails with the same error.
Does anybody know anything I could do to try to fix this error? Does it sound like some part of my local configuration is incorrectly set up?
In my project, I had added a file in app/controllers called devise_controller.rb. It looked like this:
class DeviseController < ApplicationController
# Asks Devise how much time is left until the current user is
# automatically logged out, without resetting the logout timer.
def time_until_logout
raise "let's inspect here"
end
end
When I deleted this file, the bug went away.
I filed a bug report about how adding a DeviseController caused RoR/Devise to blow up on Devise's repository: https://github.com/plataformatec/devise/issues/2520
I've got an existing rails app, and I've added an ember front-end. I'm having trouble deploying the new version (which includes Ember for the first time) to Heroku.
The problem is that I'm unable to run rake tasks in production mode.
I discovered this when I tried to rake db:migrate on heroku. I got the following error:
rake aborted!
undefined method `handlebars' for #<Rails::Application::Configuration:0x00000004f0de90>/app/.bundle/gems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configuration.rb:85:in `method_missing'
/app/config/application.rb:60:in `<class:Application>'
I get the same error if I try to run any tasks locally in production mode, e.g.:
RAILS_ENV=production rake -T
the offending line, from config/application.rb:
config.handlebars.templates_root = 'ember/templates'
for various reasons, I had to move the ember templates down one file level. and it needs to stay there. everything works fine in development mode.
Any idea how I can fix this?
tried upgrading the ember-rails gem. this didn't help. (I'm using 0.12.0)
trick was to move ember-rails gem out of assets group
This question was asked before here, but can't say that the answer helps me. I am using Rails 3.1.3. When I run rails console on my local dev machine, I get the following message:
no such file to load -- map_by_method
The message doesn't prevent the irb session from launching, so it's benign. But I'd like to get rid of it. At one point in time I had the map_by_method gem installed, but I removed it from the Gemfile and gemset -- yet the message still appears. Any idea how to vanquish it?
there might be some causes for this:
there might be some other gem which has it as a dependency
you might have a require 'map_by_method' in your code
you might have a require in your .irbrc
the .irbrc can be located in your user home or in the current working directory.
have a look at an example .irbrc here: http://matthewhutchinson.net/2010/9/19/rails-3-bash-aliases-and-irbrc-configs
Probably the gem map_by_method has done some permanent changes on your system. Try re-installing it. It should fixed your problem. Same thing happened to me once. If it doesn't, try specifying it in development section of gemfile.
I'm having the same heroku rake issues described (and from what I can tell solved) in this question.
When I try the fix (include require 'rake/dsl_definition' above require 'rake') I get the same
'uninitialized constant Rake::DSL'
error from heroku + I get the error
'no such file to load -- rake/dsl_definition'
from my local rake.
Without incorporating the fix (using the standard rakefile) I can use rake on my local setup with no errors (with the same heroku error)
I'm using rake version 0.8.7 (though I get the same results using 0.9.2) and Rails 3.0.9. I've gone through the suggestions in the previous question but from what I can tell the problem isn't with my Gemfile. Has anyone else had this problem? Has anyone else solved their heroku rake problem using a different solution? Or can anyone explain/suggest how I'm going about this incorrectly?
Thank you for your help.
Try adding require 'rake/dsl_definition' on top of Rakefile.
Not enough for me. I was getting the no such file to load -- rake/dsl_definition error even adding the require 'rake/dsl_definition' line in the "Rakefile" file
I had all gems version OK and only 0.8.7 rake version but I had to create a "Gemfile" in the redmine root path with the next content:
gem "rake", "0.8.7"
And delete the require 'rake/dsl_definition' line added previously in Rakefile
Hope be usefull for someone
Currently i'm developing 2 Rails::Engines 1 blog (for fun) and 1 csv importer and mapper. I made them with enginex and jeweler into a gem. I installed them locally and i included either 1 of them in an empty rails 3.x project and it's working fine!
The thing i want to do know is include both gems in 1 rails 3.x project. This all works doesn't raise any errors but here is the problem.
When i go to my "/blog" routes everything is rendered perfectly. But when i go to my "/csv" route i dont see any layouts. When i look at the development.log i see this:
Started GET "/csv" for 127.0.0.1 at Sun May 01 20:23:19 +0200 2011
Processing by CsvEngine::ImportsController#index as HTML
Rendered /Library/Ruby/Gems/1.8/gems/csv_engine-0.0.1/app/views/csv_engine/imports/index.html.erb within layouts/application (0.8ms)
Completed 200 OK in 24ms (Views: 23.1ms | ActiveRecord: 0.0ms)
This all looks fine, but i dont see any of my html. But when i put a <%= raise "hell %> inside my index.html.erb it gets raised. So i'm baffled here, both my engines work. All my rails logic works but i dont see my html inside the index.html.erb.
The strangest thing is when i include "csv_engine" gem without the blog gem in a empty rails 3 app everything works fine and i get the html views.
I even tried overwriting the views from within my empty host app e.g. app/views/csv_engine/imports/index.html.erb with some other html in it but this also doesnt work.
Does anyone has any idea what this could be?