parameterize 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/README.md +9 -8
- data/gemfiles/Gemfile.activerecord-3.0.x +10 -0
- data/gemfiles/Gemfile.activerecord-3.1.x +10 -0
- data/lib/parameterize.rb +5 -1
- data/lib/parameterize/version.rb +1 -1
- data/parameterize.gemspec +5 -4
- metadata +32 -16
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -6,17 +6,18 @@ It uses ActiveSupport's `String#parameterize` to create the slug. There are no v
|
|
6
6
|
|
7
7
|
## Getting Started
|
8
8
|
|
9
|
-
```ruby
|
9
|
+
``` ruby
|
10
10
|
# Gemfile
|
11
11
|
gem 'parameterize'
|
12
12
|
```
|
13
13
|
|
14
|
-
```
|
15
|
-
bundle install
|
16
|
-
rails generate model User name:string param:string
|
14
|
+
``` bash
|
15
|
+
$ bundle install
|
16
|
+
$ rails generate model User name:string param:string
|
17
|
+
# Parameterize requires a string column named 'param'
|
17
18
|
```
|
18
19
|
|
19
|
-
```ruby
|
20
|
+
``` ruby
|
20
21
|
# models/user.rb
|
21
22
|
class User < ActiveRecord::Base
|
22
23
|
parameterize :name
|
@@ -33,7 +34,7 @@ user.to_param = 'john-doe'
|
|
33
34
|
|
34
35
|
Validations **are not** included. I prefer to be able to customize my validations directly in the model. The most common validations you would add are:
|
35
36
|
|
36
|
-
```ruby
|
37
|
+
``` ruby
|
37
38
|
class Post < ActiveRecord::Base
|
38
39
|
parameterize
|
39
40
|
validates_presence_of :param
|
@@ -43,7 +44,7 @@ end
|
|
43
44
|
|
44
45
|
You could easily use [Babosa's](http://github.com/norman/babosa) #to_identifier or [Stringex's](http://github.com/rsl/stringex) #to_url instead of ActiveSupport's #parameterize by just aliasing the method you want to use:
|
45
46
|
|
46
|
-
```ruby
|
47
|
+
``` ruby
|
47
48
|
require 'babosa'
|
48
49
|
class String
|
49
50
|
alias :parameterize :to_identifier
|
@@ -52,7 +53,7 @@ end
|
|
52
53
|
|
53
54
|
There is also a Shoulda-style RSpec matcher available for use in your specs:
|
54
55
|
|
55
|
-
```ruby
|
56
|
+
``` ruby
|
56
57
|
# spec_helper.rb
|
57
58
|
require 'parameterize/matcher'
|
58
59
|
|
data/lib/parameterize.rb
CHANGED
data/lib/parameterize/version.rb
CHANGED
data/parameterize.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'parameterize'
|
7
7
|
s.version = Parameterize::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors =
|
10
|
-
s.email =
|
9
|
+
s.authors = ['Pete Browne']
|
10
|
+
s.email = ['me@petebrowne.com']
|
11
11
|
s.homepage = 'http://github.com/petebrowne/parameterize'
|
12
12
|
s.summary = %{The simplest permalink/slug solution for ActiveRecord >= 3.0}
|
13
13
|
s.description = %{It uses ActiveSupport's String#parameterize to create the slug. There are no validations. No slug history. No extra tables or models.}
|
@@ -16,8 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency 'activerecord', '~> 3.0'
|
18
18
|
s.add_dependency 'activesupport', '~> 3.0'
|
19
|
-
s.add_development_dependency '
|
20
|
-
s.add_development_dependency '
|
19
|
+
s.add_development_dependency 'rake', '>= 0.8.7'
|
20
|
+
s.add_development_dependency 'rspec', '~> 2.6'
|
21
|
+
s.add_development_dependency 'sqlite3-ruby', '~> 1.3'
|
21
22
|
|
22
23
|
s.files = `git ls-files`.split("\n")
|
23
24
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parameterize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- Pete
|
14
|
-
- Browne
|
13
|
+
- Pete Browne
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-
|
18
|
+
date: 2011-08-30 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: activerecord
|
@@ -49,37 +48,51 @@ dependencies:
|
|
49
48
|
type: :runtime
|
50
49
|
version_requirements: *id002
|
51
50
|
- !ruby/object:Gem::Dependency
|
52
|
-
name:
|
51
|
+
name: rake
|
53
52
|
prerelease: false
|
54
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 49
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
- 8
|
62
|
+
- 7
|
63
|
+
version: 0.8.7
|
64
|
+
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rspec
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
55
70
|
none: false
|
56
71
|
requirements:
|
57
72
|
- - ~>
|
58
73
|
- !ruby/object:Gem::Version
|
59
|
-
hash:
|
74
|
+
hash: 15
|
60
75
|
segments:
|
61
76
|
- 2
|
62
77
|
- 6
|
63
|
-
|
64
|
-
version: 2.6.0
|
78
|
+
version: "2.6"
|
65
79
|
type: :development
|
66
|
-
version_requirements: *
|
80
|
+
version_requirements: *id004
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
name: sqlite3-ruby
|
69
83
|
prerelease: false
|
70
|
-
requirement: &
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
71
85
|
none: false
|
72
86
|
requirements:
|
73
87
|
- - ~>
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
hash:
|
89
|
+
hash: 9
|
76
90
|
segments:
|
77
91
|
- 1
|
78
92
|
- 3
|
79
|
-
|
80
|
-
version: 1.3.3
|
93
|
+
version: "1.3"
|
81
94
|
type: :development
|
82
|
-
version_requirements: *
|
95
|
+
version_requirements: *id005
|
83
96
|
description: It uses ActiveSupport's String#parameterize to create the slug. There are no validations. No slug history. No extra tables or models.
|
84
97
|
email:
|
85
98
|
- me@petebrowne.com
|
@@ -91,10 +104,13 @@ extra_rdoc_files: []
|
|
91
104
|
|
92
105
|
files:
|
93
106
|
- .gitignore
|
107
|
+
- .travis.yml
|
94
108
|
- Gemfile
|
95
109
|
- LICENSE
|
96
110
|
- README.md
|
97
111
|
- Rakefile
|
112
|
+
- gemfiles/Gemfile.activerecord-3.0.x
|
113
|
+
- gemfiles/Gemfile.activerecord-3.1.x
|
98
114
|
- lib/parameterize.rb
|
99
115
|
- lib/parameterize/matcher.rb
|
100
116
|
- lib/parameterize/railtie.rb
|