Helperful: a large collection of Rails Helpers

Helperful aims to be a collection of useful and reusable Rails helpers.

Rails Installation

As a Gem

This is the preferred way to install Helperful and the best way if you want install a stable version.

$ gem install weppos-helperful --source http://gems.github.com"

You can specify the GEM dependency in your application environment.rb file:

```ruby Rails::Initializer.run do |config| # other configurations # …

config.gem “weppos-helperful”, :lib => “helperful”, :source => “http://gems.github.com” end ```

As a Plugin

This is the preferred way if you want to live on the edge and install a development version.

$ script/plugin install git://github.com/weppos/helperful.git

Available Helpers

The list of available helpers actually includes AffiliationsHelper, ContentHelper and the more famous TitleHelper.

Affiliations Helper

Provides a set of helpers for working with online affiliations.

For example, the tradedoubler_verification_tag helper method returns the site verification tag required by Tradedoubler to verify the publisher account ownership.

```erb # In your template <%= tradedoubler_verification_tag(‘00112233’) %>

Will produce the following output.

```

Content Helper

Provides a set of helpers for capturing and working with your page content in a more effective way.

For example, the has_content? helper is a natural fulfillment for the original content_for helper.

```erb <% content_for :foo do %>

This is a foo content.

<% end %>

<% has_content? :foo # => true %> <% has_content? “foo” # => true %> ```

Title Helper

Provides an helper for managing page title in Rails views and layouts.

ruby # Include the helper in your controller. # You might want to include it in ApplicationController to make it available # always and everywhere in your templates. class ApplicationController < ActionController::Base helperful :title end

```erb # Now you can use set a title in your action # Example. index.html.rb

<%= title 'This is a title' %>

And print the title with a :site decorator in your layout.

<%= title :site => ‘My Cool Site!’ %>

<%= yield %> ```

Documentation and Repository

Visit the project page or the documentation for further details. The repository is available on GitHub for forking or reference. Feel free to add more helpers and send me a pull request. Please ensure new helpers come with an appropriate test suite.