acts_as_dasherize_vanity 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +81 -14
- data/acts_as_dasherize_vanity.gemspec +0 -1
- data/lib/acts_as_dasherize_vanity/version.rb +1 -1
- metadata +11 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e5a15ad7f0985a5f4d6d4ba336c8b79592b7af7
|
4
|
+
data.tar.gz: c2338cc4589ca47684b0e09ef5a40d68879d97ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 680abcc93d070912072e1d9a2f534a03c289b4c13a5f20b946da0d92885edac63f564dc01a03d3c9240060787e7c7fdeda8bd7dca8443c97f94862adddb3ca49
|
7
|
+
data.tar.gz: 95b346659415d18c3a29ff1c7ffdb1a09d9773389862aca5ad8391a2fa5a2d74a6e3bf459413852516becd9a3c7e56d4e5b6854fe9157362cecec5f47d7f0aaa
|
data/README.md
CHANGED
@@ -1,16 +1,12 @@
|
|
1
|
-
|
1
|
+
Welcome to the **acts_as_dasherize_vanity**
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/acts_as_dasherize_vanity`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
3
|
|
5
|
-
|
4
|
+
This "acts_as" extension provides the capabilities a application to allow to generate meaning full dasherize vanity urls for SEO perpose.
|
6
5
|
|
7
|
-
## Installation
|
6
|
+
## Installation
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
```ruby
|
8
|
+
Gemfile:
|
12
9
|
gem 'acts_as_dasherize_vanity'
|
13
|
-
```
|
14
10
|
|
15
11
|
And then execute:
|
16
12
|
|
@@ -19,16 +15,87 @@ And then execute:
|
|
19
15
|
Or install it yourself as:
|
20
16
|
|
21
17
|
$ gem install acts_as_dasherize_vanity
|
22
|
-
|
18
|
+
|
23
19
|
## Usage
|
24
20
|
|
25
|
-
|
21
|
+
### Models:
|
22
|
+
|
23
|
+
If need to apply in User model on default field than need to add 2 field in users table
|
24
|
+
default field:
|
25
|
+
|
26
|
+
**name**
|
27
|
+
**dasherize_vanity**
|
28
|
+
|
29
|
+
and add this line in model(user.rb)
|
30
|
+
|
31
|
+
acts_as_dasherize_vanity
|
32
|
+
|
33
|
+
Example:
|
34
|
+
|
35
|
+
class User < ActiveRecord::Base
|
36
|
+
|
37
|
+
acts_as_dasherize_vanity
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
Than it will work
|
42
|
+
|
43
|
+
If have product model and need to apply in Product model on custom field than need to add 2 field custom field in products table
|
44
|
+
|
45
|
+
suppose you have filed name in product model
|
46
|
+
|
47
|
+
**product_name**
|
48
|
+
**product_dasherize_vanity_url**
|
49
|
+
|
50
|
+
than add this line in model(product.rb)
|
51
|
+
|
52
|
+
acts_as_dasherize_vanity({ initial_column: "product_name", dasherize_vanity_column: "product_dasherize_vanity_url" })
|
53
|
+
|
54
|
+
Example
|
55
|
+
|
56
|
+
class Product < ActiveRecord::Base
|
57
|
+
|
58
|
+
acts_as_dasherize_vanity({ initial_column: "product_name", dasherize_vanity_column:"product_dasherize_vanity_url" })
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
Than it will work.
|
63
|
+
|
64
|
+
### Url in view pages
|
65
|
+
for user
|
66
|
+
|
67
|
+
<%= link_to 'Dasherize Vanity Url', user_path(user.dasherize_vanity), class: 'link' %>
|
68
|
+
|
69
|
+
for product
|
70
|
+
|
71
|
+
<%= link_to 'Dasherize Vanity Url', product_path(product.product_dasherize_vanity_url), class: 'link' %>
|
72
|
+
|
73
|
+
|
74
|
+
### In controller
|
75
|
+
|
76
|
+
def set_product
|
77
|
+
if params[:id].is_number?
|
78
|
+
@product = Product.where("id = ?",params[:id]).first
|
79
|
+
else
|
80
|
+
@product = Product.where("product_dasherize_vanity_url = ?",params[:id]).first
|
81
|
+
end
|
82
|
+
end
|
26
83
|
|
27
|
-
|
84
|
+
def set_user
|
85
|
+
if params[:id].is_number?
|
86
|
+
@user = User.where("id = ?",params[:id]).first
|
87
|
+
else
|
88
|
+
@user = User.where("dasherize_vanity= ?",params[:id],params[:id]).first
|
89
|
+
end
|
90
|
+
end
|
28
91
|
|
29
|
-
|
92
|
+
## publish in rubygems
|
93
|
+
https://rubygems.org/gems/acts_as_dasherize_vanity
|
94
|
+
## on github
|
95
|
+
https://github.com/vinaytech/acts_as_dasherize_vanity
|
96
|
+
## Sample app on github
|
97
|
+
https://github.com/vinaytech/rails_sample_app_acts_as_dasherize_vanity
|
30
98
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
99
|
|
33
100
|
## Contributing
|
34
101
|
|
@@ -36,4 +103,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
36
103
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
104
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
105
|
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
-
5. Create a new Pull Request
|
106
|
+
5. Create a new Pull Request
|
metadata
CHANGED
@@ -1,57 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_dasherize_vanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinay Sanker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.9'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: ruby
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 2.0.0
|
55
41
|
description: This "acts_as" extension provides the capabilities a application to allow
|
56
42
|
to generate meaning ful urls for SEO perpose.
|
57
43
|
email:
|
@@ -60,8 +46,8 @@ executables: []
|
|
60
46
|
extensions: []
|
61
47
|
extra_rdoc_files: []
|
62
48
|
files:
|
63
|
-
-
|
64
|
-
-
|
49
|
+
- .gitignore
|
50
|
+
- .travis.yml
|
65
51
|
- CODE_OF_CONDUCT.md
|
66
52
|
- Gemfile
|
67
53
|
- LICENSE.txt
|
@@ -83,17 +69,17 @@ require_paths:
|
|
83
69
|
- lib
|
84
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
71
|
requirements:
|
86
|
-
- -
|
72
|
+
- - '>='
|
87
73
|
- !ruby/object:Gem::Version
|
88
74
|
version: '0'
|
89
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
76
|
requirements:
|
91
|
-
- -
|
77
|
+
- - '>='
|
92
78
|
- !ruby/object:Gem::Version
|
93
79
|
version: '0'
|
94
80
|
requirements: []
|
95
81
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.2.2
|
97
83
|
signing_key:
|
98
84
|
specification_version: 4
|
99
85
|
summary: A gem adding to an active_record model for dasherize vanity url, allowing
|