nagybence-railhead_permalink 0.1.1 → 0.1.2
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.
- data/lib/railhead_permalink.rb +6 -3
- data/railhead_permalink.gemspec +1 -1
- metadata +1 -1
data/lib/railhead_permalink.rb
CHANGED
@@ -12,7 +12,7 @@ module RailheadPermalink
|
|
12
12
|
|
13
13
|
module ClassMethods
|
14
14
|
def auto_permalink(field, options = {})
|
15
|
-
include
|
15
|
+
include RailheadPermalink::InstanceMethods
|
16
16
|
|
17
17
|
write_inheritable_attribute(:permalink_options, {
|
18
18
|
:field => field,
|
@@ -23,8 +23,7 @@ module RailheadPermalink
|
|
23
23
|
def find_with_permalink(*args)
|
24
24
|
key = args.first
|
25
25
|
if key.is_a?(String)
|
26
|
-
|
27
|
-
with_scope :find => options { find_without_permalink :first } or find_without_permalink(*args)
|
26
|
+
find_without_permalink(:first, :conditions => ['permalink = ?', key]) || find_without_permalink(*args)
|
28
27
|
else
|
29
28
|
find_without_permalink(*args)
|
30
29
|
end
|
@@ -41,6 +40,10 @@ module RailheadPermalink
|
|
41
40
|
end
|
42
41
|
self[:permalink] = permalink
|
43
42
|
end
|
43
|
+
|
44
|
+
def to_param
|
45
|
+
permalink
|
46
|
+
end
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
data/railhead_permalink.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "railhead_permalink"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.2"
|
4
4
|
s.date = "2009-01-27"
|
5
5
|
s.summary = "RailheadPermalink is a Ruby on Rails plugin that automatically finds ActiveRecord objects with permalink."
|
6
6
|
s.email = "nagybence@tipogral.hu"
|