RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: coffeebite
Thanks. The module inside class was suggested by @rbates himself.
module
class
I am namespacing my concerns as demonstrated in the tutorial.
I have a class Portrait and a concern Portrait::ToHash defined as
Portrait
Portrait::ToHash
class Portrait < ActiveRecord::Base #my class end class Portrait module ToHash #my methods end end
but I get this error: superclass mismatch for class
superclass mismatch for class
The error goes away if I do this:
class Portrait < ActiveRecord::Base module ToHash #my methods end end
I have 5 models and I do not need to inherit the class from ActiveRecord::Base when defining the concern in any of the others. Just this one.
ActiveRecord::Base
Any clues what could be happening?
Thanks. The
moduleinsideclasswas suggested by @rbates himself.I am namespacing my concerns as demonstrated in the tutorial.
I have a class
Portraitand a concernPortrait::ToHashdefined asbut I get this error:
superclass mismatch for classThe error goes away if I do this:
I have 5 models and I do not need to inherit the class from
ActiveRecord::Basewhen defining the concern in any of the others. Just this one.Any clues what could be happening?