Skip to content

Commit

Permalink
clarify how we generate page_path and how to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Jul 4, 2011
1 parent 8b3deec commit c3d0683
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit c3d0683

Please sign in to comment.