ruby on rails - Extend behaviour from model in shared code folder -


In my project directory I have a normal folder with some sections that we Sharing (using other techniques in the form of an engine is not an option for us at this point). We have 'duplicated' the project structure inside this folder, so we have some code like common / app / model , common / lib and so on). To load all the models we are using:

  config.autoload_paths + =% W (# {config.root} / normal / app / model # {config.root} / lib)   

But now I need to expand the behavior of classes in any normal / app / model folder.

By creating a new extended model in my first option, get into the regular App Model folder, get it from shared model , migrate to the new model, And then give some place like ExtendedModel = SharedModel inside the starter this will work, but it seems a bit tricky.

My second option was to create a new model in the Application Model folder with the same name, SharedModel and different method with the same name, but the railways are ignoring this model And it is only using SharedModel .

Any ideas will be appreciated :)

I have a added shared_model.rb file with app / model with the following content:

  Shared Module.Clash_August Def overwritten_math puts 'Hi!' End End   

and then I added a launcher with the content:

  Load ( 'App / model / shared_model.rb').   

I'm doing more testing but it starts working.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -