Sha256: b27675926d2e20337ad1c11308cbe5d5b097354ab3c42e8702f6b8c6d9fec3e0

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

High Voltage
============

Rails engine for static pages.

... but be careful. [Danger!](http://www.youtube.com/watch?v=HD5tnb2RBYg)

Static pages?
-------------

Yeah, like "About us", "Directions", marketing pages, etc.

Installation
------------

    $ gem install high_voltage

Usage
-----

Write your static pages and put them in the RAILS_ROOT/app/views/pages directory.

    mkdir app/views/pages
    touch app/views/pages/about.html.erb

After putting something interesting there, you can link to it from anywhere in your app with:

    link_to "About", page_path("about")

Bam.

Override
--------

Most common reasons to override? Authentication, layouts.

Create a PagesController of your own:

    script/generate controller pages

Then modify it to subclass from High Voltage, adding whatever you need:

    class PagesController < HighVoltage::PagesController
      before_filter :authenticate
      layout "danger"
    end

Testing
-------

Just a suggestion, but you can test your pages using Shoulda pretty easily:

    class PagesControllerTest < ActionController::TestCase
      tests PagesController

      %w(earn_money screencast about contact).each do |page|
        context "on GET to /pages/#{page}" do
          setup { get :show, :id => page }

          should_respond_with :success
          should_render_template page
        end
      end
    end

If you're not using a custom PagesController be sure to test <code>HighVoltage::PagesController</code> instead.

Enjoy!

License
-------

Copyright (c) thoughtbot, inc -- released under the MIT license.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
high_voltage-0.9.0 README.markdown