Created
June 2, 2011 21:01
-
-
Save skizzybiz/1005322 to your computer and use it in GitHub Desktop.
Problems with AR.find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainDB::App < ActiveRecord::Base | |
establish_connection :main_db | |
set_table_name "APPLICATIONS" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main_db: | |
adapter: mysql2 | |
database: "..." | |
username: rails | |
password: "..." | |
host: "..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rails console | |
Loading development environment (Rails 3.0.7) | |
ruby-1.9.2-p180 :001 > MainDB::App.find(1002169) | |
NoMethodError: undefined method `eq' for nil:NilClass | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/whiny_nil.rb:48:in `method_missing' | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/relation/finder_methods.rb:299:in `find_one' | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/relation/finder_methods.rb:289:in `find_with_ids' | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/relation/finder_methods.rb:107:in `find' | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/base.rb:439:in `find' | |
from (irb):1 | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start' | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start' | |
from /Volumes/Users/joelyou/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>' | |
from script/rails:6:in `require' | |
from script/rails:6:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solution: the table name was "applications" not "APPLICATIONS"