nagybence-railhead_permalink 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/railhead_permalink.rb +7 -5
- data/railhead_permalink.gemspec +1 -1
- metadata +1 -1
data/lib/railhead_permalink.rb
CHANGED
@@ -2,22 +2,24 @@ module RailheadPermalink
|
|
2
2
|
def self.included(base)
|
3
3
|
base.class_eval do
|
4
4
|
extend ClassMethods
|
5
|
-
class << self
|
6
|
-
alias_method_chain :find, :permalink
|
7
|
-
end
|
8
|
-
class_inheritable_reader :permalink_options
|
9
|
-
before_validation :create_permalink
|
10
5
|
end
|
11
6
|
end
|
12
7
|
|
13
8
|
module ClassMethods
|
14
9
|
def auto_permalink(field, options = {})
|
15
10
|
include RailheadPermalink::InstanceMethods
|
11
|
+
class << self
|
12
|
+
alias_method_chain :find, :permalink
|
13
|
+
end
|
14
|
+
class_inheritable_reader :permalink_options
|
16
15
|
|
17
16
|
write_inheritable_attribute(:permalink_options, {
|
18
17
|
:field => field,
|
19
18
|
:reserved_names => (options[:reserved_names] || []).concat(ActionController::Base.resources_path_names.values)
|
20
19
|
})
|
20
|
+
|
21
|
+
before_save :create_permalink
|
22
|
+
validates_presence_of field
|
21
23
|
end
|
22
24
|
|
23
25
|
def find_with_permalink(*args)
|
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.4"
|
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"
|