Reputation: 11
I've got my custom controller, model, bunch of views, helpers and other stuff that encapsulates specific amount of User management functionality sufficient for rails apps my work involves.
What I want is to create some kind of extension to be able to add all my custom things to new Rails apps swiftly. I'm quite new to Ruby on Rails but I know there are at last three ways to extend Rails - with gems, generate plugin, or Railtie. The question is - what is the best way in my situation?
Upvotes: 1
Views: 179
Reputation: 11736
Rails application templates seem to be the way to go for you.
Just create a rails project that will be the basis of your other projects, then, when you create a new rails application,
$ rails new myapp -m /path/to/your/template/project
This is going to replace the application name in your Rakefile and config.ru with the new application's name automatically. Railties and other things can go into this project, too.
Upvotes: 1
Reputation: 4766
A better to extend in this case is to use Rails Engine. You can create a gem based on this engine as well, and plug to other rails app.
Basically, Rails Engine allows you to share subset of functionality to other applications. For example, a blog engine, a forum by https://github.com/radar/forem, authentication engine by https://github.com/plataformatec/devise or a user management (in your case).
Go to the documentation or railscasts episode for more about it. http://railscasts.com/episodes/149-rails-engines
Upvotes: 0
Reputation: 19485
Go with a gem, which can optionally make use of Railties to hook into Rails. Plugins are deprecated and will be removed in Rails 4.0
Upvotes: 0