ruby on rails - Extend behaviour from model in shared code folder -
In my project directory I have a But now I need to expand the behavior of classes in any By creating a new My second option was to create a new model in the Application Model folder with the same name, Any ideas will be appreciated :) I have a and then I added a launcher with the content: I'm doing more testing but it starts working. 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)
normal / app / model folder.
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.
SharedModel and different method with the same name, but the railways are ignoring this model And it is only using
SharedModel .
added shared_model.rb file with
app / model with the following content:
Shared Module.Clash_August Def overwritten_math puts 'Hi!' End End
Load ( 'App / model / shared_model.rb').
Comments
Post a Comment