Gem Version Code Climate Build Status Dependency Status

Tuning

Common tools used in rails extracted into a gem.

Install

Put this line in your Gemfile:

gem 'tuning'

Then bundle:

$ bundle

Controllers

Use error method to respond with status 500 and show 500.html (if format it's html):

error

Use not_found to respond with status 404 and show 404.html (if format it's html):

not_found

Use unauthorized to respond with status 401 and show 422.html (if format it's html):

unauthorized

Use forbidden to respond with status 403 and show 422.html (if format it's html):

forbidden

Use unprocessable_entity to respond with status 422 and show 422.html (if format it's html):

unprocessable_entity

Views

Use content_tag_if if you want wrap content into some tag if certain condition it's true:

<%= content_tag_if request.path == home_path, :h1 do %>
  <%= link_to 'Home', home_path, id: 'logo' %>
<% end %>

Use active_trail? if you want to check if some path is on active trail:

<li class="<%= 'active' if active_trail? some_path %>"></li>

Credits

This gem is maintained and funded by museways.

License

It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.