markh
July 22, 2010, 7:42am
#1
My app works fine in development on my laptop but in production on my
server I get “We’re sorry, but something went wrong. We’ve been notified
about this issue and we’ll take a look at it shortly.”
I am using Rails 3, Ruby 1.8.7, Apache and passenger 2.2.15
I get the welcome aboard page in production if I just go to the domain
name but as soon as I want data I get the above error. There are no
messages in any logs for apache or rails. In production.rb I have
config.log_level = :debug
cap deploy:migrate works fine with this code in deploy.rb
namespace :deploy do
task :restart do
run “touch #{current_path}/tmp/restart.txt”
end
task :seed do
run “cd #{current_path}; rake db:seed RAILS_ENV=production”
end
end
How can I test that my app is running in the production environment on
my server?
markh
July 22, 2010, 8:08am
#2
I finally found this in log/production.log
Started GET “/sports_orgs” for 120.146.245.33 at Wed Jul 21 23:00:35
-0700 2010
LoadError (no such file to load – pg):
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:212:in
`require’
However, when I installed the gem the error still occurs and gem -v pg
returns 1.3.7
markh
July 22, 2010, 9:02am
#3
did you restart your web server?
markh
July 22, 2010, 9:05am
#4
Ben Bruscella wrote:
did you restart your web server?
Many times
Also I uninstalled and reinstalled the pg gem as well. I also installed
ruby-pg and postgres gems.
markh
July 22, 2010, 9:25am
#5
Now I get
Error message:
undefined method `assert_valid_keys’ for :games:Symbol
Exception class: NoMethodError
The development environment still works fine, this error occurs on the
server and the code has been freshly uploaded by capistrano without
error.
I have no method or test named assert_valid_keys
markh
July 22, 2010, 10:24am
#6
On 22 July 2010 08:25, Mark H. [email protected] wrote:
I have no method or test named assert_valid_keys
What did you do to make the previous error with pg go away?
Show us the error trace and the code around where the error occurs in
your code
Also please the relationships between any relevant models.
Colin
markh
July 22, 2010, 1:34pm
#7
Colin L. wrote:
On 22 July 2010 08:25, Mark H. [email protected] wrote:
I have no method or test named assert_valid_keys
What did you do to make the previous error with pg go away?
I believe that may have been an earlier error and was genuine. I did
install pg again.
Show us the error trace and the code around where the error occurs in
your code
Also please the relationships between any relevant models.
class Card < ActiveRecord::Base
belongs_to :players, :games
==================
class Game < ActiveRecord::Base
belongs_to :leagues
has_many :cards
==================
create_table :cards do |t|
t.integer :game_id,
:null => false,
:options =>
"CONSTRAINT fk_cards_game REFERENCES games(id)"
===================
0
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/associations.rb
1662 in create_belongs_to_reflection' 1 /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/associations.rb 1127 in
belongs_to’
2 (eval) 3 in belongs_to' 3 /var/www/sportdata/releases/20100722072020/app/models/card.rb 3 4 /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb 212 in
require’
5
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb
212 in require' 6 /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb 200 in
load_dependency’
7
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb
212 in require' 8 /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb 319 in
require_or_load’
9
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb
273 in depend_on' 10 /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb 189 in
require_dependency’
11 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/engine.rb
138 in eager_load!' 12 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/engine.rb 137 in
each’
13 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/engine.rb
137 in eager_load!' 14 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/engine.rb 135 in
each’
15 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/engine.rb
135 in eager_load!' 16 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb 99 in
eager_load!’
17
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application/finisher.rb
41
18
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb
25 in instance_exec' 19 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb 25 in
run’
20
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb
55 in run_initializers' 21 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb 54 in
each’
22
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb
54 in run_initializers' 23 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb 119 in
initialize!’
24
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb
81 in send' 25 /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb 81 in
method_missing’
26 /var/www/sportdata/releases/20100722072020/config/environment.rb 5
27 config.ru 3 in require' 28 config.ru 3 29 /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb 46 in
instance_eval’
30 /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb 46 in
initialize' 31 config.ru 1 in
new’
32 config.ru 1
markh
July 22, 2010, 2:20pm
#9
On 22 July 2010 12:34, Mark H. [email protected] wrote:
Show us the error trace and the code around where the error occurs in
your code
Also please the relationships between any relevant models.
class Card < ActiveRecord::Base
belongs_to :players, :games
Try
belongs_to :players
belongs_to :games
Colin
markh
July 22, 2010, 9:52pm
#10
On 22 July 2010 20:31, Mark H. [email protected] wrote:
Colin L. wrote:
Try
belongs_to :players
belongs_to :games
Thanks! That fixed it.
If you look at the docs for belongs_to you will see that
belongs_to :model1, :model2 is not valid code. It is a pity that
rails is not able to give a better error message for this however. (I
found it by googling for your error message by the way. Google is
often much quicker than asking for help).
Colin