Browse files

Tweak URL path prefix patch to address feedback from xaviershay

When reviewing my pull request, xaviershay requested these changes:

* Use ActionController::Base.config.relative_url_root instead of
  ENV['RAILS_RELATIVE_URL_ROOT'] in the UrlHelper and
* Mention the feature in the README, because it won't be found in

Implement these, but use Rails.configuration instead of
ActionController::Base.config, as it seems like the current Rails best
  • Loading branch information...
1 parent 925cf43 commit 06bdeaf2fadf79732f65812f0e30487398ef02bf Marcel M. Cary committed Apr 18, 2013
Showing with 8 additions and 2 deletions.
  1. +6 −0 README.textile
  2. +1 −1 app/helpers/url_helper.rb
  3. +1 −1
@@ -38,6 +38,12 @@ Enki is a compact, easily extendable base for your blog. It does this by being h
* If you're not using OpenID you're a chump
* Hacking code is the easiest way to customize something
+h2. URL path prefix
+Enki can run your blog with a URL path prefix. For example, you can run it at*blog* instead of You can do so with the RAILS_RELATIVE_URL_ROOT environment variable, set either before starting the server or in config/application.rb before Enki::Application. Uncommenting this line in config/application.rb will enable this behavior in all environments:
+<pre><code>ENV['RAILS_RELATIVE_URL_ROOT'] = '/blog'</code></pre>
h2. How it differs from Mephisto
Mephisto is feature packed and quite customizable. It can however be daunting trying to find your way around the code, which isn’t so good if you’re trying to hack in your own features. Enki strips out a lot of the features that you probably don’t need (multiple authors and liquid templates, for example), and focuses on keeping a tight code base that is easy to comprehend and extend.
@@ -2,7 +2,7 @@ module UrlHelper
def post_path(post, options = {})
suffix = options[:anchor] ? "##{options[:anchor]}" : ""
path = post.published_at.strftime("/%Y/%m/%d/") + post.slug + suffix
- path = "#{ENV['RAILS_RELATIVE_URL_ROOT']}#{path}"
+ path = "#{Rails.configuration.action_controller.relative_url_root}#{path}"
path = URI.join(enki_config[:url], path) if options[:only_path] == false
@@ -2,6 +2,6 @@
require ::File.expand_path('../config/environment', __FILE__)
+map Rails.configuration.action_controller.relative_url_root || "/" do
run Enki::Application

0 comments on commit 06bdeaf

Please sign in to comment.