Search code examples
ruby-on-railscode-reuseuniversal

Rails 3: How can I reuse code in my next project?


I want to reuse some controllers, models, stylesheets, images and views in upcoming projects. How is it possible in Rails 3, to have these be standard components, when I create a new project (rails new $project) ?


Solution

  • Extract them into Engine or Gems. Structure stylesheets, images in assets. It's not only possible it in fact the standard solution to do. Read some gems to learn this (Devise, kaminari, to name a few).