How to solve the `Object doesn't support #inspect` error?
There are two constants called Article
on your app. One is your active record class, top level constant. The other is the module Category::Article
.
When you do belongs_to :article
, it would seem that rails starts looking for an Article
constant in the class the belongs_to is called from so it is finding the wrong one. This causes all sorts of mess, since you obviously can't use an activerecord class and a module interchangeably
Setting :class_name => '::Article'
forces the top level Article
class to be found instead.
Object doesn't support #inspect
Not necessarily a full answer to this question but we tried using the pry gem instead of IRB.
gem 'pry-rails'
Added this to our development group and now uses pry instead of irb. No issues.
Must be some sort of corruption on IRB. The version we were using was 1.3.5
(Object doesn't support #inspect) Stuck at the console
try this has_and_belongs_to_many :pages, :inverse_of => :editors
in your AdminUser model i think that should be the problem.
Related Topics
Why Does .All? Return True on an Empty Array
Differencebetween Ruby's 'Open-Uri' and 'Net:Http' Gems
Str.Each in Ruby Isn't Working
Simplest Way to Send Raw Byte-Arrays Using Ruby's Tcpsocket-Class
Stop Loading Page Watir-Webdriver
Ruby.Metaprogramming. Class_Eval
Why Doesn't Relative_Require Work on Ruby 1.8.6
Undefined Method 'Name' for "Actionmailer":String
How to Find Gems That Depend on a Given Gem
Cocoon Add Association, How to Limit Number of Associations
Ruby: Building a Plot of Function
Difference Between or and || When Setting Variables
In Ruby How to Use Class Level Local Variable? (A Ruby Newbie's Question)
Tcp Socket Communication Between Processes on Heroku Worker Dyno
How to Write an Rspec Test for a Ruby Method That Contains "Gets.Chomp"