#265 open
Pascal

prefix table names in the database

Reported by Pascal | March 30th, 2009 @ 12:08 AM

With all those engines creating tables in the database, the 'regular' app table names may clash with those.

An example: my app needs an Activity model with a 'activities' table, but one engine already uses that table name.

I propose to re-base every model classes in adva to a class named like Adva::ActiveRecordBase which will look like this:

module Adva
  class ActiveRecordBase < ActiveRecord::Base
    def self.table_name_prefix
      "adva_"
    end
  end
end

With this new base class, every adva model will use a table name prefix (thanx to AR).

Note that I put the class in the Adva module, I think every adva models should also be namedspaced, so not only the tablenames are but also the model classes.

Thanx for listening.

Pascal

Comments and changes to this ticket

  • Clemens Kofler

    Clemens Kofler March 30th, 2009 @ 10:27 PM

    This sounds like a pretty good idea to me. We should definitely look into that. Thanks for suggesting it, Pascal!

  • Marko Seppä

    Marko Seppä June 18th, 2009 @ 04:21 PM

    • State changed from “new” to “open”

    Added to product backlog as 'namespacing adva-cms'.

  • Pascal

    Pascal June 18th, 2009 @ 09:37 PM

    BTW, I implemented such a system in an engine I developed.
    For the base class to act correctly with STI we need also to tell AR it's an abstract class.
    So here is the revised base class:

    module Adva

    class ActiveRecordBase < ActiveRecord::Base
      def self.table_name_prefix
        "adva_"
      end
    
      self.abstract_class = true
    end
    

    end

    Concerning namespacing the adva classes such as the models, I also did implement that, I had issues when specifying associations on the models. To work around these issues I had to add the :class_name options to every association to include the namespace, like:
    module Adva

    class Section < ActiveRecordBase
      has_many :articles, :class_names => 'Adva::Article'
    end
    

    end

    I stay tuned.

    Regards,

    Pascal

  • meocatshirt

    meocatshirt March 27th, 2021 @ 04:03 PM

    Placeit has lots of puppy T-blouse templates and cool shirt ideas to be had to choose from, together with the only beneath: If you are seeking to grow your on line store or simply want to branch out into something new, there’s continually the possibility of starting a business of custom-designed products. ew people cat shirt There are severa fulfillment apps available for Shopify which include dropshipping from Chinese shops and all that.

  • Erika Maer

    Erika Maer April 27th, 2021 @ 06:42 PM

    Is it Academized a safe writing service for me? I want to get more information about this company and its writers. Who will tell essayservices.review ?

  • Coretechnology

    Coretechnology June 17th, 2021 @ 10:33 AM

    Save your PC components from failing and yourself from the headache of rebuilding your PC from scratch. We rounded up the high-quality motherboards in the marketplace for you. https://bestmotherboard.net/ Whether you’re setting out to construct a PC to rival the satisfactory PCs or sincerely upgrading your current one, we’ll locate you a quality board.

  • mediaagency

    mediaagency June 19th, 2021 @ 09:33 AM

    For this, an awesome advertising package deal should consist of content material writing and programs. The content created have to be of high first-rate and it should be engaging. There need to be a risk for the content to develop with time. social media marketing companies in mumbai Besides, your content material can by no means rule without being search engine optimization pleasant. So, choose the enterprise which could offer you with the most interactive and expert content. Enquire the marketing crew and the professionalism of the writers.

  • scanmykitchen

    scanmykitchen August 11th, 2021 @ 12:50 PM

    In regards to the alternative intended benefits of ingesting celery juice to https://scanmykitchen.com/best-juicers-for-celery/
    assist reverse continual diseases inclusive of liver sickness, high blood pressure, acid reflux, or heart sickness, I could recommend you to talk over with your healthcare provider considering the fact that there just isn’t enough clinical evidence to support the ones claims.

  • getrealad

    getrealad August 14th, 2021 @ 11:28 AM

    First of all, the quantity spent on real property marketing will rely totally on your income and the resources you have at your disposal. real estate marketing agency Most marketers suggest spending about 10% of your commissions on advertising. You need to find the advertising finances that works for you. This leaves you to don't forget your average commission on income, the common final sales fee of the houses you promote and the extent of transactions performed in every area and year.

  • picobudspro

    picobudspro September 8th, 2021 @ 11:07 AM

    Do you have trouble listening to surely in noisy environments? Do you have got problem listening to a legitimate or a voice at more distances? Do you've got difficulty communicating with other humans because of your hearing loss? Well, quite a few humans feel embarrassed about listening to loss. PicoBuds However, it's miles a completely commonplace condition this is present in a third of adults global.

  • Linda Gilbert

    Linda Gilbert September 9th, 2021 @ 04:49 PM

    If it's taking more work to vacuum your house, it's probably time to replace the vacuum agitator belt. The good news is you can do it yourself in about fifteen minutes with two screwdrivers. Read at For Comfy Home

  • Matkaz

    Matkaz October 13th, 2021 @ 07:53 AM

    Time Bazar Khiladi 420, Sona Matka , Kalyan Matka Boss 440, Matka India Net. We Delivers Daily Or Weekly Indian Satta Fix Ank Otg. Matka One, Simple Matka Guessing Param Matka Guessing Trick 143 Surya Alex. Similar Key Tags Rae Boss Matka, Matka Boss, Satta Boss.

  • cordlesshairclip

    cordlesshairclip November 5th, 2021 @ 08:57 AM

    The package comes with a beard trimmer with blade protect, a frame trimmer head, a hair trimmer head, a precision trimmer head, a nostril trimmer head, charger, charging dock, Best cordless hair clippers six guide combs, a styling comb, cleaning brush, storage pouch and commands. Wahl is usually called a main emblem for men’s beard and hair trimmers, and this wireless hair clipper lives as much as the agency’s standards of excellent, strength, and precision.

  • edwardhenry

    edwardhenry November 5th, 2021 @ 12:04 PM

    Check my site approved coupon it is really good and gives the best coupons and promo code.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<p>Cutting edge cms, blog, wiki, forum ... plattform.</p>

<p>Find the code on <a href="http://github.com/svenfuchs/adva_cms/tree/master">GitHub: adva cms</a></p>

<p>Part of the business application framework <a href="http://www.advabest.org/">adva best</a>.</p>

Pages