Creating Rails Gems
I want to build my application in a modular way: For example I might have:
Users->has_and_belongs_to_many->Projects
Users->has_and_belongs_to_many->Tasks
Projects->has_many->Tasks
Tasks->belongs_to->Project (1 task belongs to 1 project.)
Note: Projects AND tasks can have many users.
The way I was thinking of building this is by doing:
User = Gem
Projects = Gem
Tasks = Gem
Each can return either json (for ember) or html. Neither depend on each
other, The idea is that each is just a detail. Rails, ember and html are
all just details.
How could I go about this and at the end of the day hook them together
like a puzzle? or is this even feasible?
Right now I have the user piece of this concept almost done. It contains
models, tests, controllers and views. Can I bundle that as a gem or should
I only bundle the controller and the models? This "User" gem would make
use of friendlyId gem to make the urls look nice, infact all the "gems"
(project, tasks and users) will depend on this gem.
What would you recommend to do to have the kind of modularity I want? is
it good practice? bad practice?
No comments:
Post a Comment