1
0
mirror of https://github.com/danbee/slugtastic synced 2025-03-04 08:49:05 +00:00
slugtastic/index.html

89 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<title>Slugtastic by danbee</title>
</head>
<body>
<header>
<div class="container">
<h1>Slugtastic</h1>
<h2>A simple slug generator for Rails.</h2>
<section id="downloads">
<a href="https://github.com/danbee/slugtastic/zipball/master" class="btn">Download as .zip</a>
<a href="https://github.com/danbee/slugtastic/tarball/master" class="btn">Download as .tar.gz</a>
<a href="https://github.com/danbee/slugtastic" class="btn btn-github"><span class="icon"></span>View on GitHub</a>
</section>
</div>
</header>
<div class="container">
<section id="main_content">
<h1>
<a name="slugtastic" class="anchor" href="#slugtastic"><span class="octicon octicon-link"></span></a>Slugtastic</h1>
<p>Simple gem for autogenerating permalink style slugs for your ActiveRecord models.</p>
<h2>
<a name="requirements" class="anchor" href="#requirements"><span class="octicon octicon-link"></span></a>Requirements</h2>
<ul>
<li>Ruby 1.9.2 or 1.9.3</li>
<li>Rails 3.1 or higher.</li>
</ul><p>It should work with Rails 3.0 but it hasn't been tested.</p>
<h2>
<a name="installation" class="anchor" href="#installation"><span class="octicon octicon-link"></span></a>Installation</h2>
<p>Add this line to your application's Gemfile:</p>
<pre><code>gem 'slugtastic'
</code></pre>
<p>And then execute:</p>
<pre><code>$ bundle
</code></pre>
<p>Or install it yourself as:</p>
<pre><code>$ gem install slugtastic
</code></pre>
<h2>
<a name="usage" class="anchor" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2>
<p>Usage is very simple. Just add the following to your model:</p>
<pre><code>has_slug :slug, :from =&gt; :title
</code></pre>
<p>This will generate a slug string from the title atrribute and store it in the slug attribute unless the slug already contains a string. The slug is generated pre-validation so you can still use <code>validates_presence_of :slug</code>.</p>
<p>There are no extra options at present.</p>
<h2>
<a name="contributing" class="anchor" href="#contributing"><span class="octicon octicon-link"></span></a>Contributing</h2>
<ol>
<li>Fork it</li>
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
<li>Commit your changes (<code>git commit -am 'Added some feature'</code>)</li>
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
<li>Create new Pull Request</li>
</ol>
</section>
</div>
</body>
</html>