Skip to content

Creating your own Spud Engine

veloper edited this page Oct 15, 2012 · 2 revisions

Creating your own Spud Engine is not too difficult. We have even provided a template gem to get the ball rolling which you can find at:

http://www.github.com/davydotcom/spud_template

In this gem you can add engine specific customizations to lib/spud_template/configuration.rb NOTE: It is recommended you rename all references to spud_template to line up with the name of your new engine (i.e. spud_blog).

To add your spud engine admin apps to the spud administrative panel simply add to your lib/spud_template/engine.rb

initializer :admin do
    Spud::Core.configure do |config|
        config.admin_applications += [{:name => "App Name",:thumbnail => "thumb",:url => "url"}]
    end
end

Controllers

When adding your own controllers to the admin panel it is best that they all extend Spud::Admin::ApplicationController rather than ApplicationController. This will add the necessary helper methods to maintain the look and feel of the spud administrative panel. Also when creating an administrative controller be sure to add the line

belongs_to_spud_app :app_name

Models

When it comes to models it is of best practice to prefix all spud_specific engine models with spud (i.e. SpudPost / spud_post.rb) Be sure they do not interfere with other spud related gems and for added protection name your tables with a prefix of the entire engine_name in the first place.

Clone this wiki locally