Delete a merge model in Rails

Hi, I would like to know if it is possible to remove the association in rails.

Well, I have something similar to this:

class Home < ActiveRecord::Base
  include settings
end

In settings.rb, I have something similar to this

module Settings
  attr_reader :person
  attr_reader :address

  def self.included(base)
      base.belongs_to :city
      base.belongs_to :entity
      [...]
  end

  [...]

end

In the home class, the association of a city model in my particular case does not make sense. And I have to find a way to remove it in order to support my DRY code.

Thank!

NOTE. Give me feedback before you vote.

+3
source share
1 answer

If you just don’t want the methods used remove_methodto remove them.

+2
source

Source: https://habr.com/ru/post/1726319/


All Articles