Hi all,

We're looking to use our own namespace for the tables of Spree. At present
its using spree_users, spree_user_roles etc. I'd ideally like to choose our
own prefix similar to Wordpress. Is that possible without using a decorator
for every Spree model?

Many thanks in advance,

Ryan

Search Discussions

  • Weston Platter at Oct 9, 2013 at 7:43 pm
    Ryan,

    In addition to Jonathan's answer, you could also override the model's
    tablename, EG,

    # my_spree_app/config/initializers/qe.rb
    module Qe
       mattr_accessor :table_name_prefix
       self.table_name_prefix ||= 'qe_'
    end
       # my_spree_app/models/some_class.rb
    class SomeClass < ActiveRecord::Base
       self.table_name = "#{Qe.table_name_prefix}#{self.table_name}"
    end

    On Wednesday, October 9, 2013 7:57:50 AM UTC-6, Ryan wrote:

    Hi all,

    We're looking to use our own namespace for the tables of Spree. At present
    its using spree_users, spree_user_roles etc. I'd ideally like to choose our
    own prefix similar to Wordpress. Is that possible without using a decorator
    for every Spree model?

    Many thanks in advance,

    Ryan

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedOct 9, '13 at 1:57p
activeOct 9, '13 at 7:43p
posts2
users2
websitespreecommerce.com
irc#RubyOnRails

2 users in discussion

Weston Platter: 1 post Ryan: 1 post

People

Translate

site design / logo © 2022 Grokbase