Model Using Modules in Rails Application

前端 未结 2 1707
死守一世寂寞
死守一世寂寞 2020-12-28 08:49

I have a model that requires loading external data from an auxiliary source. A number of web services exist that my model can fetch the data from (swappable), but I don\'t w

2条回答
  •  隐瞒了意图╮
    2020-12-28 09:35

    This link has helped me out around this.

    http://ander.heroku.com/2010/12/14/concerns-in-rails-3/

    I have been sticking it in a model/extensions directory. The concerns directory makes sense but the word 'concerns' doesn't feel obvious to me. Maybe it will grow on me.

    I also added the extensions path in the application.rb

    config.autoload_paths += %W(#{config.root}/app/models/extensions)
    

提交回复
热议问题