class Ecrire::Theme::Engine < Rails::Engine

Engine is the foundation of Rails. It can be used to encapsulate part of the application and this is exactly what it does here.

Ecrire::Theme::Engine is the block that hooks into Ecrire::Application to provide Theme support.

This class is the only element that the Gem includes at runtime.

Everything else is defined in the user's theme folder.

This engine is the reason why it's possible to have Ecrire as a gem and theme as user's folder.


  1. post_path

    Defined so Ecrire can link from the admin to a post. This is also needed when listing all the titles a post has and the URL they represent.

Instance methods

  1. has_migrations? ()

    Disables migration for now. Any Rails::Engine instance can support migrations which means that Theme could have their own models.

    It's likely that at some point this behavior is resumed but I want to make sure that I understand the implication before turning this back on.

    For example, I would like to make sure that the Admin is shelled from those future migrations.

  2. paths ()

    Return paths for a theme. The paths follow the structure of the default theme.

    It creates a new Rails::Paths because it's highly customized and it was less readable to disable and changes every paths.

    This could be modified in the user's theme.

  3. root_path (file = '')

    Return the #root_path for the current theme

    The method starts at the current working directory and moves from parent to parent until it either finds or it reaches the root.

    Raise an error if it reaches the root and can't find