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:
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
Post a Comment