jodosha (owner)

Revisions

gist: 120532 Download_button fork
public
Public Clone URL: git://gist.github.com/120532.git
Embed All Files: show embed
app/controllers/tags_controller.rb #
1
2
3
4
5
class TagsController < ApplicationController
  def show
    @tag = Tag.find_by_permalink!(params[:id])
  end
end
app/models/tag.rb #
1
2
3
4
5
6
7
class Tag < ActiveRecord::Base
  has_permalink :name, :unless => lambda { |tag| tag.name.blank? }
 
  def to_param
    permalink
  end
end
config/routes.rb #
1
map.resources :tags
view.html.erb #
1
2
<!-- generic view -->
<%= link_to h(@tag.name), tag_path(@tag) %>