Sha256: 29434283fabeda74d5ee0688222d6ac5f3af9ded56e2d01b1e39b8cbae75917c

Contents?: true

Size: 510 Bytes

Versions: 11

Compression:

Stored size: 510 Bytes

Contents

# encoding: UTF-8

require File.expand_path("../helper", __FILE__)

class Article < Ohm::Model
  include Ohm::Slug
  attribute :title

  def to_s
    title
  end
end

test "to_param" do
  article = Article.create(:title => "A very Unique and Interesting String?'")

  assert '1-a-very-unique-and-interesting-string' == article.to_param
end

test "finding" do
  article = Article.create(:title => "A very Unique and Interesting String?'")

  assert 1 == Article["1-a-very-unique-and-interesting-string"].id
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ohm-contrib-2.0.0.alpha5 test/slug.rb
ohm-contrib-2.0.0.alpha4 test/slug.rb
ohm-contrib-2.0.0.alpha3 test/slug.rb
ohm-contrib-2.0.0.alpha2 test/slug.rb
ohm-contrib-1.2 test/slug.rb
ohm-contrib-1.1.0 test/slug.rb
ohm-contrib-1.0.1 test/slug.rb
ohm-contrib-1.0.0 test/slug.rb
ohm-contrib-1.0.0.rc5 test/slug.rb
ohm-contrib-1.0.0.rc4 test/slug.rb
ohm-contrib-1.0.0.rc3 test/slug.rb