Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaola2 committed Dec 5, 2014
1 parent 81a7356 commit 69823a9
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,30 @@ Morphing is a Rails engine that allows you to morph into your users temporarily.

NOTE: This library assumes you're using devise.

## Installation
## Usage

Add the following to your Gemfile:

```ruby
gem 'morphing'
```

and be sure to ```bundle install```.

Add the following to your ```app/helpers/application_helper.rb```:
and be sure to ```bundle install``` and add to your routes:

```ruby
module ApplicationHelper
include Morphing::ApplicationHelper
YourApplication::Application.routes.draw do
...
morphing_for
...
end
```

and add to your routes:
To use the ```morphed?``` helper, Add the following to your ```app/helpers/application_helper.rb```:

```ruby
morphing_for
module ApplicationHelper
include Morphing::ApplicationHelper
end
```

Then place a link somewhere only admins can see:
Expand All @@ -41,9 +43,11 @@ If you're morphed, you can provide a link to unmorph:
= link_to "Unmorph", unmorph_path
```

## Overriding controller behavior
We recommend making this a big red banner that makes it clear you're morphed! (Future releases will have this included.)

If you want to override the behavior of the controller, for example to add or skip before filters, or to perform authorization, just subclass the MorphingController somewhere in your application:
## Customizing controller behavior

If you want to customize the behavior of the controller, for example to add or skip before filters, or to perform authorization, just subclass the MorphingController somewhere in your application:

```ruby
class MorphingController < Morphing::MorphingController
Expand All @@ -54,7 +58,11 @@ end
Then, pass that controller as an argument to the routes helper:

```ruby
morphing_for controller: 'morphing'
YourApplication::Application.routes.draw do
...
morphing_for controller: 'morphing'
...
end
```

## Sponsor
Expand Down

0 comments on commit 69823a9

Please sign in to comment.