Permalink
Browse files

clarify how we generate page_path and how to avoid conflicts

  • Loading branch information...
1 parent 8b3deec commit c3d06835b843776efc90bc1fb40d8819778d54a5 @mjankowski mjankowski committed Jul 4, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 README.md
View
8 README.md
@@ -58,6 +58,14 @@ In that case, you'd need an app/views/pages/home.html.erb file.
Generally speaking, you need to route to the 'show' action with an :id param of the view filename.
+High Voltage will generate a named route method of `page_path` which you can use, as well. If you
+want to generate a named route (with the :as routing option) for some route which will be handled
+by High Voltage, make sure not to use :page as the name, because that will conflict with the named
+route generated by High Voltage itself. For example, this will work for top-level routes (we will
+get a named route called `static_path` which does not conflict with the generated `page_path` method):
+
+ match '/:id' => 'high_voltage/pages#show', :as => :static, :via => :get
+
You can route the root url to a high voltage page like this:
root :to => 'high_voltage/pages#show', :id => 'home'

0 comments on commit c3d0683

Please sign in to comment.