mm-sluggable 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +1 -1
  2. data/Rakefile +1 -1
  3. data/lib/mm-sluggable.rb +2 -1
  4. metadata +3 -22
data/README.rdoc CHANGED
@@ -7,7 +7,7 @@ Tiny plugin for MongoMapper to cache a slugged version of a field
7
7
  Either load it into all models, or individual models:
8
8
 
9
9
  # add to all models
10
- MongoMapper::Document.append_inclusions(MongoMapper::Plugins::Sluggable)
10
+ MongoMapper::Document.plugin(MongoMapper::Plugins::Sluggable)
11
11
 
12
12
  # add to a specific model
13
13
  plugin MongoMapper::Plugins::Sluggable
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ spec = Gem::Specification.new do |s|
15
15
 
16
16
  # Change these as appropriate
17
17
  s.name = "mm-sluggable"
18
- s.version = "0.2.0"
18
+ s.version = "0.2.1"
19
19
  s.summary = "Tiny plugin for MongoMapper to cache a slugged version of a field"
20
20
  s.author = "Richard Livsey"
21
21
  s.email = "richard@livsey.org"
data/lib/mm-sluggable.rb CHANGED
@@ -15,6 +15,7 @@ module MongoMapper
15
15
  :index => true,
16
16
  :method => :parameterize,
17
17
  :scope => nil,
18
+ :max_length => 256,
18
19
  :callback => [:before_validation, {:on => :create}]
19
20
  }.merge(options)
20
21
 
@@ -36,7 +37,7 @@ module MongoMapper
36
37
  to_slug = self[options[:to_slug]]
37
38
  return if to_slug.blank?
38
39
 
39
- the_slug = raw_slug = to_slug.send(options[:method]).to_s
40
+ the_slug = raw_slug = to_slug.send(options[:method]).to_s[0...options[:max_length]]
40
41
 
41
42
  conds = {}
42
43
  conds[options[:key]] = the_slug
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm-sluggable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
5
+ version: 0.2.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Richard Livsey
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-09 00:00:00 +00:00
13
+ date: 2011-05-18 00:00:00 +01:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 59
30
- segments:
31
- - 0
32
- - 9
33
- - 0
34
24
  version: 0.9.0
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,9 +32,6 @@ dependencies:
42
32
  requirements:
43
33
  - - ">="
44
34
  - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
35
  version: "0"
49
36
  type: :development
50
37
  version_requirements: *id002
@@ -76,23 +63,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
63
  requirements:
77
64
  - - ">="
78
65
  - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
66
  version: "0"
83
67
  required_rubygems_version: !ruby/object:Gem::Requirement
84
68
  none: false
85
69
  requirements:
86
70
  - - ">="
87
71
  - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
72
  version: "0"
92
73
  requirements: []
93
74
 
94
75
  rubyforge_project:
95
- rubygems_version: 1.4.1
76
+ rubygems_version: 1.6.2
96
77
  signing_key:
97
78
  specification_version: 3
98
79
  summary: Tiny plugin for MongoMapper to cache a slugged version of a field