ruby - Accessing a Rails model name from within a lib file of the same method -
this may seem silly question have model named ad , have library name auto contains class ad(lib/auto.rb).
#auto.rb lib file module auto class ad def initialize ... end def convert # here access model class ad # ::ad not work. requiring not work either. end end end does rails 3 store models under global namespace?
am missing or defining auto::ad? if so, ::ad never work. use auto::ad or ad (from within auto module). if don't want auto namespace . remvoe module auto part in code.
Comments
Post a Comment