HappyPath
- Navigate to your
posts/new
form. - Fill it out, hit create.
- Go do other stuff.
- Navigate back to your last post.
- But wait what was the id of that post?
- Go to command line
rails c
your way into typingPost.last.id
- Go to
posts/id
- Tedious.
With HappyPath, you can just do:
- Navigate to your
posts/new
form. - Fill it out, hit create.
- Go do other stuff.
- Navigate back to your last post with
/posts/last
.
This is enabled for /last
and /first
.
Installation
Add this line to your application's Gemfile:
gem 'happy_path'
And then execute:
$ bundle
Or install it yourself as:
$ gem install happy_path
How Do the Things?
After installation, put extend HappyPath
in your ApplicationController
and then any controllers you want this functionality to work in such as posts_controller.rb
.
Then put setup_happy_path
in ApplicationController, and follow_happy_paths
in each other controller and you are good to go.
Contributing
- Fork it ( http://github.com/
/happy_path/fork ) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request