permalinker 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +8 -22
- data/lib/permalinker/string_ext.rb +2 -1
- data/permalinker.gemspec +3 -5
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b78d614d0bd3f845f5517bd08277a459c10bbc
|
4
|
+
data.tar.gz: c9165b4ea5bff62c1a0e738efe82bfbb951583e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89612c64a892705c7f02ee280b2ed657df4ae2924785f6d8cd8c8f2e2e623b4f150306729590456d0c289fd2bfec0dbbe7aec83783f414d01d86a03b26fd3a95
|
7
|
+
data.tar.gz: 4e3b2f141b718dd2382372aebd576f8e91342b9d5e3e9c35605da44960de5cb4629f47b943ddd3c92166861249dd95d922a242d475333538744cc68da201e802
|
data/README.markdown
CHANGED
@@ -12,40 +12,25 @@ Usage
|
|
12
12
|
Add the method call `permalink` to your model. Your model should have a `permalink` attribute.
|
13
13
|
|
14
14
|
class Page < ActiveRecord::Base
|
15
|
-
permalink :
|
16
|
-
end
|
17
|
-
|
18
|
-
You can specify the permalink field:
|
19
|
-
|
20
|
-
class page < ActiveRecord::Base
|
21
|
-
permalink :title, :to => :title_permalink
|
15
|
+
permalink :permalink # Add your permalink column name here
|
22
16
|
end
|
23
17
|
|
24
18
|
If you don't want to use `permalink`, you can call `'some text'.to_permalink` string method and
|
25
19
|
manage the permalink process by yourself.
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
def to_param
|
30
|
-
"#{id}-#{permalink}"
|
31
|
-
end
|
32
|
-
|
33
|
-
You can define the `to_param` format:
|
21
|
+
You can define the the attributes you want to use
|
34
22
|
|
35
23
|
class Page < ActiveRecord::Base
|
36
|
-
permalink :title, :to_param => %w(
|
24
|
+
permalink :title, :to_param => %w( permalink page)
|
37
25
|
end
|
38
26
|
|
39
|
-
The
|
40
|
-
|
41
|
-
If you want to generate unique permalink, use the `:unique` option:
|
27
|
+
The id will automatically be included
|
42
28
|
|
43
|
-
|
44
|
-
permalink :title, :unique => true, :to_param => :permalink
|
45
|
-
end
|
29
|
+
The above settings will generate something link `100-some-title-page`. By overriding `to_param` method you don't have to change a thing on your app routes.
|
46
30
|
|
47
|
-
The permalink is generated using `ActiveSupport::Multibyte::Chars` class; this means that characters will properly replaced from `áéíó` to `aeio`, for instance.
|
48
31
|
|
32
|
+
The permalink is generated by replacing letters like "ä" to "ae", "ß" to "ss", "æ" to "ae", etc... so you can use it with every word and get nice urls!
|
33
|
+
|
49
34
|
The permalink is created when `before_validation` callback is evaluated. This plugin also tries
|
50
35
|
to generate a permalink when `before_save` callback is evaluated and the instance has no permalink set.
|
51
36
|
|
@@ -58,6 +43,7 @@ You can force the permalink generation by setting the `:force` option.
|
|
58
43
|
## License
|
59
44
|
|
60
45
|
Copyright (c) 2011 Nando Vieira, released under the MIT license
|
46
|
+
|
61
47
|
Modified 2014 - Florian Eck
|
62
48
|
|
63
49
|
Permission is hereby granted, free of charge, to any person obtaining
|
data/permalinker.gemspec
CHANGED
@@ -3,11 +3,11 @@ require "./lib/permalinker/version"
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "permalinker"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.1"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Florian Eck"]
|
9
9
|
s.email = ["it-support@friends-systems.de"]
|
10
|
-
s.homepage = "
|
10
|
+
s.homepage = "https://github.com/florianeck/permalink"
|
11
11
|
s.summary = "Generate permalink attributes on ActiveRecord, based on Permalink gem by Nando Vieira"
|
12
12
|
s.description = s.summary
|
13
13
|
|
@@ -15,9 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
|
-
|
19
|
-
s.add_dependency "friendly_extensions"
|
20
|
-
|
18
|
+
|
21
19
|
s.add_development_dependency "activerecord"
|
22
20
|
s.add_development_dependency "sqlite3-ruby"
|
23
21
|
s.add_development_dependency "test-unit"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permalinker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Eck
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: friendly_extensions
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: activerecord
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +162,7 @@ files:
|
|
176
162
|
- spec/support/post.rb
|
177
163
|
- spec/support/schema.rb
|
178
164
|
- spec/support/shared.rb
|
179
|
-
homepage:
|
165
|
+
homepage: https://github.com/florianeck/permalink
|
180
166
|
licenses: []
|
181
167
|
metadata: {}
|
182
168
|
post_install_message:
|