Share common models between two Rails Application -


i developing e-commerce application , working on admin website. these 2 applications have same business domain , there few models e-commerce application need in admin app.

i have found few solutions online sharing models although not clear better , how should implement it.

solutions found:

  1. create rake task copy models e-commerce app admin app

  2. create third ruby module , put models in there , pull models app directory newly created lib , require inside app

  3. auto loading models e-commerce app admin ruby search

    config.autoload_paths += %w(#{config.root}/../e-commerce-app/app/models/) 

i think second solution right way though unsure of how implement it.

none of these.

how creating shared gem , put on private git repo. rails can provide same mechanism autoloading models within application packaging gem rails_engine

see example

at end require within gemfile

gem 'my_gem_name', git: 'http:my_git_repo.com/my_gem_name' 

a more advance solution creating rest service desired data in e-commerce app , consume in admin app. users (and authentication) make sence extract separate app , provide userauthentication service.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -