2

In a Rails 4 project using comfortable_mexican_sofa gem for content management, how do you change the default database table names?

I'd like to remove the 'comfy_' prefix so they are just 'cms_blocks', 'cms_pages', etc...

wintondeshong
  • 1,257
  • 15
  • 19

1 Answers1

3
class ComfyWhateverElseMore < ActiveRecord::Base
  self.table_name = "whatever_you_wish"
end

For reference consider the api docs

adamliesko
  • 1,887
  • 1
  • 14
  • 21
  • That answer is Sofa King great! – mvw Jul 27 '15 at 15:48
  • Right, I'm aware of how to customize ActiveRecord model table names. I attempted to do this very thing for the 'comfortable_mexican_sofa' gem's various models without luck. Hoping for feedback in the context of this package specifically. – wintondeshong Jul 28 '15 at 15:51
  • After further digging I opened an issue given I found hardcoded table names in scopes. May not be possible given conventional approaches https://github.com/comfy/comfortable-mexican-sofa/issues/675 – wintondeshong Jul 28 '15 at 16:11